test_compat_responses_v03() — langchain Function Reference
Architecture documentation for the test_compat_responses_v03() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 46ba48ef_9078_1c6b_d823_70b11a8f3fe3["test_compat_responses_v03()"] 48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"] 46ba48ef_9078_1c6b_d823_70b11a8f3fe3 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5 style 46ba48ef_9078_1c6b_d823_70b11a8f3fe3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 2531–2589
def test_compat_responses_v03() -> None:
# Check compatibility with v0.3 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": "Reasoning summary"}],
},
"tool_outputs": [
{
"type": "web_search_call",
"id": "websearch_123",
"status": "completed",
}
],
"refusal": "I cannot assist with that.",
},
response_metadata={"id": "resp_123"},
id="msg_123",
)
message = _convert_from_v03_ai_message(message_v03)
expected = AIMessage(
content=[
{
"type": "reasoning",
"summary": [{"type": "summary_text", "text": "Reasoning summary"}],
"id": "rs_123",
},
{
"type": "text",
"text": "Hello, world!",
"annotations": [{"type": "foo"}],
"id": "msg_123",
},
{"type": "refusal", "refusal": "I cannot assist with that."},
{"type": "web_search_call", "id": "websearch_123", "status": "completed"},
],
response_metadata={"id": "resp_123"},
id="resp_123",
)
assert message == expected
## Check no mutation
assert message != message_v03
assert len(message_v03.content) == 1
assert all(
item in message_v03.additional_kwargs
for item in ["reasoning", "tool_outputs", "refusal"]
)
# Convert back
message_v03_output = _convert_to_v03_ai_message(message)
assert message_v03_output == message_v03
assert message_v03_output is not message_v03
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/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test_compat_responses_v03() defined?
test_compat_responses_v03() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 2531.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free