Home / Function/ test_structured_output_parsing_error_with_retry() — langchain Function Reference

test_structured_output_parsing_error_with_retry() — langchain Function Reference

Architecture documentation for the test_structured_output_parsing_error_with_retry() function in test_response_format.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5e221af7_5e23_e30c_4966_86ce324fcade["test_structured_output_parsing_error_with_retry()"]
  d1d579f8_d411_ce75_6fa3_d97e725405cb["TestResponseFormatAsToolStrategy"]
  5e221af7_5e23_e30c_4966_86ce324fcade -->|defined in| d1d579f8_d411_ce75_6fa3_d97e725405cb
  style 5e221af7_5e23_e30c_4966_86ce324fcade fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 530–564

    def test_structured_output_parsing_error_with_retry(self) -> None:
        """Test that retry handles parsing errors for structured output."""
        tool_calls = [
            [
                {
                    "name": "WeatherBaseModel",
                    "id": "1",
                    "args": {"invalid": "data"},
                },
            ],
            [
                {
                    "name": "WeatherBaseModel",
                    "id": "2",
                    "args": WEATHER_DATA,
                },
            ],
        ]

        model = FakeToolCallingModel(tool_calls=tool_calls)

        agent = create_agent(
            model,
            [],
            response_format=ToolStrategy(
                WeatherBaseModel,
                handle_errors=(StructuredOutputValidationError,),
            ),
        )

        response = agent.invoke({"messages": [HumanMessage("What's the weather?")]})

        # HumanMessage, AIMessage, ToolMessage, AIMessage, ToolMessage
        assert len(response["messages"]) == 5
        assert response["structured_response"] == EXPECTED_WEATHER_PYDANTIC

Domain

Subdomains

Frequently Asked Questions

What does test_structured_output_parsing_error_with_retry() do?
test_structured_output_parsing_error_with_retry() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py.
Where is test_structured_output_parsing_error_with_retry() defined?
test_structured_output_parsing_error_with_retry() is defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py at line 530.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free