test_with_structured_output() — langchain Function Reference
Architecture documentation for the test_with_structured_output() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 91faa3ff_49cf_f9dc_82f9_d12db3206289["test_with_structured_output()"] f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"] 91faa3ff_49cf_f9dc_82f9_d12db3206289 -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f style 91faa3ff_49cf_f9dc_82f9_d12db3206289 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 690–707
def test_with_structured_output() -> None:
llm = ChatAnthropic(
model=MODEL_NAME, # type: ignore[call-arg]
)
structured_llm = llm.with_structured_output(
{
"name": "get_weather",
"description": "Get weather report for a city",
"input_schema": {
"type": "object",
"properties": {"location": {"type": "string"}},
},
},
)
response = structured_llm.invoke("what's the weather in san francisco, ca")
assert isinstance(response, dict)
assert response["location"]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_with_structured_output() do?
test_with_structured_output() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py.
Where is test_with_structured_output() defined?
test_with_structured_output() is defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py at line 690.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free