test_compat_responses_v03() — langchain Function Reference
Architecture documentation for the test_compat_responses_v03() function in test_openai.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 51d44612_88ef_d8ff_d012_f5eca96cd505["test_compat_responses_v03()"] 71a6a26a_d6f8_432f_996a_21e56fcab4ae["test_openai.py"] 51d44612_88ef_d8ff_d012_f5eca96cd505 -->|defined in| 71a6a26a_d6f8_432f_996a_21e56fcab4ae style 51d44612_88ef_d8ff_d012_f5eca96cd505 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/messages/block_translators/test_openai.py lines 320–476
def test_compat_responses_v03() -> None:
# Check compatibility with v0.3 legacy message format
message_v03 = AIMessage(
content=[
{"type": "text", "text": "Hello, world!", "annotations": [{"type": "foo"}]}
],
additional_kwargs={
"reasoning": {
"type": "reasoning",
"id": "rs_123",
"summary": [
{"type": "summary_text", "text": "summary 1"},
{"type": "summary_text", "text": "summary 2"},
],
},
"tool_outputs": [
{
"type": "web_search_call",
"id": "websearch_123",
"status": "completed",
}
],
"refusal": "I cannot assist with that.",
"__openai_function_call_ids__": {"call_abc": "fc_abc"},
},
tool_calls=[
{"type": "tool_call", "name": "my_tool", "args": {"x": 3}, "id": "call_abc"}
],
response_metadata={"id": "resp_123", "model_provider": "openai"},
id="msg_123",
)
expected_content: list[types.ContentBlock] = [
{"type": "reasoning", "id": "rs_123", "reasoning": "summary 1"},
{"type": "reasoning", "id": "rs_123", "reasoning": "summary 2"},
{
"type": "text",
"text": "Hello, world!",
"annotations": [
{"type": "non_standard_annotation", "value": {"type": "foo"}}
],
"id": "msg_123",
},
{
"type": "non_standard",
"value": {"type": "refusal", "refusal": "I cannot assist with that."},
},
{
"type": "tool_call",
"name": "my_tool",
"args": {"x": 3},
"id": "call_abc",
"extras": {"item_id": "fc_abc"},
},
{
"type": "server_tool_call",
"name": "web_search",
"args": {},
"id": "websearch_123",
},
{
"type": "server_tool_result",
"tool_call_id": "websearch_123",
"status": "success",
},
]
assert message_v03.content_blocks == expected_content
# --- Test chunks --- #
# Tool calls
chunk_1 = AIMessageChunk(
content=[],
additional_kwargs={"__openai_function_call_ids__": {"call_abc": "fc_abc"}},
tool_call_chunks=[
{
"type": "tool_call_chunk",
"name": "my_tool",
"args": "",
"id": "call_abc",
"index": 0,
Domain
Subdomains
Source
Frequently Asked Questions
What does test_compat_responses_v03() do?
test_compat_responses_v03() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/block_translators/test_openai.py.
Where is test_compat_responses_v03() defined?
test_compat_responses_v03() is defined in libs/core/tests/unit_tests/messages/block_translators/test_openai.py at line 320.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free