Home / Function/ test_retry_with_custom_string_message() — langchain Function Reference

test_retry_with_custom_string_message() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 614–651

    def test_retry_with_custom_string_message(self) -> None:
        """Test retry with custom static string message."""
        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="Please provide valid weather data with temperature and condition.",
            ),
        )

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

        assert len(response["messages"]) == 5
        assert (
            response["messages"][2].content
            == "Please provide valid weather data with temperature and condition."
        )
        assert response["structured_response"] == EXPECTED_WEATHER_PYDANTIC

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free