Home / Function/ test_pydantic_model() — langchain Function Reference

test_pydantic_model() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  bceba0ea_866a_8753_87af_396975cc6dbe["test_pydantic_model()"]
  5b61036b_6078_395b_d306_03640f401013["TestResponseFormatAsModel"]
  bceba0ea_866a_8753_87af_396975cc6dbe -->|defined in| 5b61036b_6078_395b_d306_03640f401013
  e78b3523_64fb_b7d4_d54b_4890d8859016["test_pydantic_model()"]
  e78b3523_64fb_b7d4_d54b_4890d8859016 -->|calls| bceba0ea_866a_8753_87af_396975cc6dbe
  061a614a_464f_9e0b_35c0_a82acc8032e9["test_pydantic_model()"]
  061a614a_464f_9e0b_35c0_a82acc8032e9 -->|calls| bceba0ea_866a_8753_87af_396975cc6dbe
  e78b3523_64fb_b7d4_d54b_4890d8859016["test_pydantic_model()"]
  bceba0ea_866a_8753_87af_396975cc6dbe -->|calls| e78b3523_64fb_b7d4_d54b_4890d8859016
  style bceba0ea_866a_8753_87af_396975cc6dbe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 116–135

    def test_pydantic_model(self) -> None:
        """Test response_format as Pydantic model."""
        tool_calls = [
            [{"args": {}, "id": "1", "name": "get_weather"}],
            [
                {
                    "name": "WeatherBaseModel",
                    "id": "2",
                    "args": WEATHER_DATA,
                }
            ],
        ]

        model = FakeToolCallingModel(tool_calls=tool_calls)

        agent = create_agent(model, [get_weather], response_format=WeatherBaseModel)
        response = agent.invoke({"messages": [HumanMessage("What's the weather?")]})

        assert response["structured_response"] == EXPECTED_WEATHER_PYDANTIC
        assert len(response["messages"]) == 5

Domain

Subdomains

Frequently Asked Questions

What does test_pydantic_model() do?
test_pydantic_model() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py.
Where is test_pydantic_model() defined?
test_pydantic_model() is defined in libs/langchain_v1/tests/unit_tests/agents/test_response_format.py at line 116.
What does test_pydantic_model() call?
test_pydantic_model() calls 1 function(s): test_pydantic_model.
What calls test_pydantic_model()?
test_pydantic_model() is called by 2 function(s): test_pydantic_model, test_pydantic_model.

Analyze Your Own Codebase

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

Try Supermodel Free