test_structured_output_deeply_nested() — langchain Function Reference
Architecture documentation for the test_structured_output_deeply_nested() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5eaf1e4a_0a99_3480_f89a_23690c169246["test_structured_output_deeply_nested()"] 71dcb56e_a445_727d_c4bb_5dc733f24038["test_chat_models.py"] 5eaf1e4a_0a99_3480_f89a_23690c169246 -->|defined in| 71dcb56e_a445_727d_c4bb_5dc733f24038 style 5eaf1e4a_0a99_3480_f89a_23690c169246 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models.py lines 116–145
def test_structured_output_deeply_nested(model: str) -> None:
"""Test to verify structured output with a nested objects."""
llm = ChatOllama(model=model, temperature=0)
class Person(BaseModel):
"""Information about a person."""
name: str | None = Field(default=None, description="The name of the person")
hair_color: str | None = Field(
default=None, description="The color of the person's hair if known"
)
height_in_meters: str | None = Field(
default=None, description="Height measured in meters"
)
class Data(BaseModel):
"""Extracted data about people."""
people: list[Person]
chat = llm.with_structured_output(Data)
text = (
"Alan Smith is 6 feet tall and has blond hair."
"Alan Poe is 3 feet tall and has grey hair."
)
result = chat.invoke(text)
assert isinstance(result, Data)
for chunk in chat.stream(text):
assert isinstance(chunk, Data)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_structured_output_deeply_nested() do?
test_structured_output_deeply_nested() is a function in the langchain codebase, defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models.py.
Where is test_structured_output_deeply_nested() defined?
test_structured_output_deeply_nested() is defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models.py at line 116.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free