test_validation_error_with_invalid_response() — langchain Function Reference
Architecture documentation for the test_validation_error_with_invalid_response() function in test_response_format.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 15eab12c_0956_c53a_4e7b_716084c91cdb["test_validation_error_with_invalid_response()"] ab8da393_2432_e6a3_7963_47ccc7b82fac["TestResponseFormatAsProviderStrategy"] 15eab12c_0956_c53a_4e7b_716084c91cdb -->|defined in| ab8da393_2432_e6a3_7963_47ccc7b82fac d3c39084_3dca_90f9_645a_60c7f057f5ed["test_validation_error_with_invalid_response()"] d3c39084_3dca_90f9_645a_60c7f057f5ed -->|calls| 15eab12c_0956_c53a_4e7b_716084c91cdb d3c39084_3dca_90f9_645a_60c7f057f5ed["test_validation_error_with_invalid_response()"] 15eab12c_0956_c53a_4e7b_716084c91cdb -->|calls| d3c39084_3dca_90f9_645a_60c7f057f5ed style 15eab12c_0956_c53a_4e7b_716084c91cdb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 706–730
def test_validation_error_with_invalid_response(self) -> None:
"""Test validation error with invalid response.
Test that StructuredOutputValidationError is raised when provider strategy
receives invalid response.
"""
tool_calls = [
[{"args": {}, "id": "1", "name": "get_weather"}],
]
# But we're using WeatherBaseModel which has different field requirements
model = FakeToolCallingModel(
tool_calls=tool_calls,
structured_response={"invalid": "data"}, # Wrong structure
)
agent = create_agent(
model, [get_weather], response_format=ProviderStrategy(WeatherBaseModel)
)
with pytest.raises(
StructuredOutputValidationError,
match=r".*WeatherBaseModel.*",
):
agent.invoke({"messages": [HumanMessage("What's the weather?")]})
Domain
Subdomains
Source
Frequently Asked Questions
What does test_validation_error_with_invalid_response() do?
test_validation_error_with_invalid_response() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py.
Where is test_validation_error_with_invalid_response() defined?
test_validation_error_with_invalid_response() is defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py at line 706.
What does test_validation_error_with_invalid_response() call?
test_validation_error_with_invalid_response() calls 1 function(s): test_validation_error_with_invalid_response.
What calls test_validation_error_with_invalid_response()?
test_validation_error_with_invalid_response() is called by 1 function(s): test_validation_error_with_invalid_response.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free