test_structured_output_thinking_enabled() — langchain Function Reference
Architecture documentation for the test_structured_output_thinking_enabled() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0e4cb637_834e_9995_421c_2d083bb8f55a["test_structured_output_thinking_enabled()"] f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"] 0e4cb637_834e_9995_421c_2d083bb8f55a -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f style 0e4cb637_834e_9995_421c_2d083bb8f55a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 1158–1175
def test_structured_output_thinking_enabled() -> None:
llm = ChatAnthropic(
model="claude-sonnet-4-5-20250929", # type: ignore[call-arg]
max_tokens=5_000, # type: ignore[call-arg]
thinking={"type": "enabled", "budget_tokens": 2_000},
)
with pytest.warns(match="structured output"):
structured_llm = llm.with_structured_output(GenerateUsername)
query = "Generate a username for Sally with green hair"
response = structured_llm.invoke(query)
assert isinstance(response, GenerateUsername)
with pytest.raises(OutputParserException):
structured_llm.invoke("Hello")
# Test streaming
for chunk in structured_llm.stream(query):
assert isinstance(chunk, GenerateUsername)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_structured_output_thinking_enabled() do?
test_structured_output_thinking_enabled() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py.
Where is test_structured_output_thinking_enabled() defined?
test_structured_output_thinking_enabled() is defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py at line 1158.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free