test__construct_lc_result_from_responses_api_mixed_search_responses() — langchain Function Reference
Architecture documentation for the test__construct_lc_result_from_responses_api_mixed_search_responses() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 03403669_b067_318b_91ff_8d462c084f27["test__construct_lc_result_from_responses_api_mixed_search_responses()"] 48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"] 03403669_b067_318b_91ff_8d462c084f27 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5 style 03403669_b067_318b_91ff_8d462c084f27 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 1953–2059
def test__construct_lc_result_from_responses_api_mixed_search_responses() -> None:
"""Test a response with both web search and file search outputs."""
response = Response(
id="resp_123",
created_at=1234567890,
model="gpt-4o",
object="response",
parallel_tool_calls=True,
tools=[],
tool_choice="auto",
output=[
ResponseOutputMessage(
type="message",
id="msg_123",
content=[
ResponseOutputText(
type="output_text", text="Here's what I found:", annotations=[]
)
],
role="assistant",
status="completed",
),
ResponseFunctionWebSearch(
id="websearch_123",
type="web_search_call",
status="completed",
action=ActionSearch(type="search", query="search query"),
),
ResponseFileSearchToolCall(
id="filesearch_123",
type="file_search_call",
status="completed",
queries=["python code"],
results=[
Result(
file_id="file_123",
filename="example.py",
score=0.95,
text="def hello_world() -> None:\n print('Hello, world!')",
)
],
),
],
)
# v0
result = _construct_lc_result_from_responses_api(response, output_version="v0")
# Check message content
assert result.generations[0].message.content == [
{"type": "text", "text": "Here's what I found:", "annotations": []}
]
# Check tool outputs
assert "tool_outputs" in result.generations[0].message.additional_kwargs
assert len(result.generations[0].message.additional_kwargs["tool_outputs"]) == 2
# Check web search output
web_search = next(
output
for output in result.generations[0].message.additional_kwargs["tool_outputs"]
if output["type"] == "web_search_call"
)
assert web_search["id"] == "websearch_123"
assert web_search["status"] == "completed"
# Check file search output
file_search = next(
output
for output in result.generations[0].message.additional_kwargs["tool_outputs"]
if output["type"] == "file_search_call"
)
assert file_search["id"] == "filesearch_123"
assert file_search["queries"] == ["python code"]
assert file_search["results"][0]["filename"] == "example.py"
# responses/v1
result = _construct_lc_result_from_responses_api(response)
assert result.generations[0].message.content == [
{
Domain
Subdomains
Source
Frequently Asked Questions
What does test__construct_lc_result_from_responses_api_mixed_search_responses() do?
test__construct_lc_result_from_responses_api_mixed_search_responses() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test__construct_lc_result_from_responses_api_mixed_search_responses() defined?
test__construct_lc_result_from_responses_api_mixed_search_responses() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 1953.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free