test_model_response_with_response_type() — langchain Function Reference
Architecture documentation for the test_model_response_with_response_type() function in test_middleware_typing.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d47b41ff_6f24_eb0a_3940_83313e37bac9["test_model_response_with_response_type()"] 689eac1f_5845_440c_f60b_988968e02ee6["test_middleware_typing.py"] d47b41ff_6f24_eb0a_3940_83313e37bac9 -->|defined in| 689eac1f_5845_440c_f60b_988968e02ee6 style d47b41ff_6f24_eb0a_3940_83313e37bac9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_typing.py lines 414–424
def test_model_response_with_response_type() -> None:
"""Test that ModelResponse preserves ResponseT."""
response: ModelResponse[AnalysisResult] = ModelResponse(
result=[AIMessage(content="test")],
structured_response=AnalysisResult(sentiment="positive", confidence=0.9),
)
# Type checker knows structured_response is AnalysisResult | None
if response.structured_response is not None:
_sentiment: str = response.structured_response.sentiment
_confidence: float = response.structured_response.confidence
Domain
Subdomains
Source
Frequently Asked Questions
What does test_model_response_with_response_type() do?
test_model_response_with_response_type() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_typing.py.
Where is test_model_response_with_response_type() defined?
test_model_response_with_response_type() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_typing.py at line 414.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free