test_union_of_types() — langchain Function Reference
Architecture documentation for the test_union_of_types() function in test_response_format.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 23781697_11db_b103_59c5_3967778fc4f2["test_union_of_types()"] 2970c11e_b43a_df0c_1a52_30da10d3689c["test_response_format.py"] 23781697_11db_b103_59c5_3967778fc4f2 -->|defined in| 2970c11e_b43a_df0c_1a52_30da10d3689c c948cda5_5fc6_2444_e1bf_c723dd398626["test_union_of_types()"] c948cda5_5fc6_2444_e1bf_c723dd398626 -->|calls| 23781697_11db_b103_59c5_3967778fc4f2 c948cda5_5fc6_2444_e1bf_c723dd398626["test_union_of_types()"] 23781697_11db_b103_59c5_3967778fc4f2 -->|calls| c948cda5_5fc6_2444_e1bf_c723dd398626 style 23781697_11db_b103_59c5_3967778fc4f2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 874–899
def test_union_of_types() -> None:
"""Test response_format as ProviderStrategy with Union (if supported)."""
tool_calls = [
[{"args": {}, "id": "1", "name": "get_weather"}],
[
{
"name": "WeatherBaseModel",
"id": "2",
"args": WEATHER_DATA,
}
],
]
model = FakeToolCallingModel(
tool_calls=tool_calls, structured_response=EXPECTED_WEATHER_PYDANTIC
)
agent = create_agent(
model,
[get_weather, get_location],
response_format=ToolStrategy(WeatherBaseModel | LocationResponse),
)
response = agent.invoke({"messages": [HumanMessage("What's the weather?")]})
assert response["structured_response"] == EXPECTED_WEATHER_PYDANTIC
assert len(response["messages"]) == 5
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does test_union_of_types() do?
test_union_of_types() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py.
Where is test_union_of_types() defined?
test_union_of_types() is defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py at line 874.
What does test_union_of_types() call?
test_union_of_types() calls 1 function(s): test_union_of_types.
What calls test_union_of_types()?
test_union_of_types() is called by 1 function(s): test_union_of_types.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free