test__construct_lc_result_from_responses_api_file_search_response() — langchain Function Reference
Architecture documentation for the test__construct_lc_result_from_responses_api_file_search_response() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d5717198_8df0_fbe3_09b2_9d53a6384fe7["test__construct_lc_result_from_responses_api_file_search_response()"] 48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"] d5717198_8df0_fbe3_09b2_9d53a6384fe7 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5 style d5717198_8df0_fbe3_09b2_9d53a6384fe7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 1862–1950
def test__construct_lc_result_from_responses_api_file_search_response() -> None:
"""Test a response with file search output."""
response = Response(
id="resp_123",
created_at=1234567890,
model="gpt-4o",
object="response",
parallel_tool_calls=True,
tools=[],
tool_choice="auto",
output=[
ResponseFileSearchToolCall(
id="filesearch_123",
type="file_search_call",
status="completed",
queries=["python code", "langchain"],
results=[
Result(
file_id="file_123",
filename="example.py",
score=0.95,
text="def hello_world() -> None:\n print('Hello, world!')",
attributes={"language": "python", "size": 42},
)
],
)
],
)
# v0
result = _construct_lc_result_from_responses_api(response, output_version="v0")
assert "tool_outputs" in result.generations[0].message.additional_kwargs
assert len(result.generations[0].message.additional_kwargs["tool_outputs"]) == 1
assert (
result.generations[0].message.additional_kwargs["tool_outputs"][0]["type"]
== "file_search_call"
)
assert (
result.generations[0].message.additional_kwargs["tool_outputs"][0]["id"]
== "filesearch_123"
)
assert (
result.generations[0].message.additional_kwargs["tool_outputs"][0]["status"]
== "completed"
)
assert result.generations[0].message.additional_kwargs["tool_outputs"][0][
"queries"
] == ["python code", "langchain"]
assert (
len(
result.generations[0].message.additional_kwargs["tool_outputs"][0][
"results"
]
)
== 1
)
assert (
result.generations[0].message.additional_kwargs["tool_outputs"][0]["results"][
0
]["file_id"]
== "file_123"
)
assert (
result.generations[0].message.additional_kwargs["tool_outputs"][0]["results"][
0
]["score"]
== 0.95
)
# responses/v1
result = _construct_lc_result_from_responses_api(response)
assert result.generations[0].message.content == [
{
"type": "file_search_call",
"id": "filesearch_123",
"status": "completed",
"queries": ["python code", "langchain"],
"results": [
{
"file_id": "file_123",
Domain
Subdomains
Source
Frequently Asked Questions
What does test__construct_lc_result_from_responses_api_file_search_response() do?
test__construct_lc_result_from_responses_api_file_search_response() 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_file_search_response() defined?
test__construct_lc_result_from_responses_api_file_search_response() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 1862.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free