test__construct_responses_api_input_ai_message_with_tool_calls() — langchain Function Reference
Architecture documentation for the test__construct_responses_api_input_ai_message_with_tool_calls() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD fcf3fe10_3cbc_c2ff_2b72_a888a9f113b2["test__construct_responses_api_input_ai_message_with_tool_calls()"] 48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"] fcf3fe10_3cbc_c2ff_2b72_a888a9f113b2 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5 style fcf3fe10_3cbc_c2ff_2b72_a888a9f113b2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 2202–2245
def test__construct_responses_api_input_ai_message_with_tool_calls() -> None:
"""Test that AI messages with tool calls are properly converted."""
tool_calls = [
{
"id": "call_123",
"name": "get_weather",
"args": {"location": "San Francisco"},
"type": "tool_call",
}
]
ai_message = AIMessage(
content=[
{
"type": "function_call",
"name": "get_weather",
"arguments": '{"location": "San Francisco"}',
"call_id": "call_123",
"id": "fc_456",
}
],
tool_calls=tool_calls,
)
result = _construct_responses_api_input([ai_message])
assert len(result) == 1
assert result[0]["type"] == "function_call"
assert result[0]["name"] == "get_weather"
assert result[0]["arguments"] == '{"location": "San Francisco"}'
assert result[0]["call_id"] == "call_123"
assert result[0]["id"] == "fc_456"
# Message with only tool calls attribute provided
ai_message = AIMessage(content="", tool_calls=tool_calls)
result = _construct_responses_api_input([ai_message])
assert len(result) == 1
assert result[0]["type"] == "function_call"
assert result[0]["name"] == "get_weather"
assert result[0]["arguments"] == '{"location": "San Francisco"}'
assert result[0]["call_id"] == "call_123"
assert "id" not in result[0]
Domain
Subdomains
Source
Frequently Asked Questions
What does test__construct_responses_api_input_ai_message_with_tool_calls() do?
test__construct_responses_api_input_ai_message_with_tool_calls() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test__construct_responses_api_input_ai_message_with_tool_calls() defined?
test__construct_responses_api_input_ai_message_with_tool_calls() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 2202.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free