_check_response() — langchain Function Reference
Architecture documentation for the _check_response() function in test_responses_api.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b0966d53_e5bb_3879_d8d6_00823de68309["_check_response()"] 992496d5_b7d4_139f_00cf_3e585d851f81["test_responses_api.py"] b0966d53_e5bb_3879_d8d6_00823de68309 -->|defined in| 992496d5_b7d4_139f_00cf_3e585d851f81 2037583b_1787_28d8_8640_e55a631bf086["test_web_search()"] 2037583b_1787_28d8_8640_e55a631bf086 -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 b7c7fdab_8de0_5d29_0383_2ffa7b7d4970["test_web_search_async()"] b7c7fdab_8de0_5d29_0383_2ffa7b7d4970 -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 5fa2c5a9_ac31_8b26_6694_cadabb4d86d5["test_function_calling()"] 5fa2c5a9_ac31_8b26_6694_cadabb4d86d5 -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 24c11427_0fa4_2b54_2137_182ca37afbc3["test_file_search()"] 24c11427_0fa4_2b54_2137_182ca37afbc3 -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 f3e5d093_21b9_fa67_83b6_8a6f12a90bca["test_code_interpreter()"] f3e5d093_21b9_fa67_83b6_8a6f12a90bca -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 5826d574_86c2_f643_4ca9_96c1ed47fb4e["test_image_generation_streaming()"] 5826d574_86c2_f643_4ca9_96c1ed47fb4e -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 8cef8119_769e_ecbc_363f_5cf82014bd24["test_image_generation_multi_turn()"] 8cef8119_769e_ecbc_363f_5cf82014bd24 -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 1ac07fd5_fc83_7a44_8a20_ffb3d8fc1f3e["test_image_generation_multi_turn_v1()"] 1ac07fd5_fc83_7a44_8a20_ffb3d8fc1f3e -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309 style b0966d53_e5bb_3879_d8d6_00823de68309 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py lines 26–58
def _check_response(response: BaseMessage | None) -> None:
assert isinstance(response, AIMessage)
assert isinstance(response.content, list)
for block in response.content:
assert isinstance(block, dict)
if block["type"] == "text":
assert isinstance(block.get("text"), str)
annotations = block.get("annotations", [])
for annotation in annotations:
if annotation["type"] == "file_citation":
assert all(
key in annotation
for key in ["file_id", "filename", "file_index", "type"]
)
elif annotation["type"] == "web_search":
assert all(
key in annotation
for key in ["end_index", "start_index", "title", "type", "url"]
)
elif annotation["type"] == "citation":
assert all(key in annotation for key in ["title", "type"])
if "url" in annotation:
assert "start_index" in annotation
assert "end_index" in annotation
text_content = response.text # type: ignore[operator,misc]
assert isinstance(text_content, str)
assert text_content
assert response.usage_metadata
assert response.usage_metadata["input_tokens"] > 0
assert response.usage_metadata["output_tokens"] > 0
assert response.usage_metadata["total_tokens"] > 0
assert response.response_metadata["model_name"]
assert response.response_metadata["service_tier"] # type: ignore[typeddict-item]
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _check_response() do?
_check_response() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py.
Where is _check_response() defined?
_check_response() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py at line 26.
What calls _check_response()?
_check_response() is called by 8 function(s): test_code_interpreter, test_file_search, test_function_calling, test_image_generation_multi_turn, test_image_generation_multi_turn_v1, test_image_generation_streaming, test_web_search, test_web_search_async.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free