Home / Function/ test_dataclass() — langchain Function Reference

test_dataclass() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  35d32d19_72c9_9082_184e_ed5e1d4d3da9["test_dataclass()"]
  d1d579f8_d411_ce75_6fa3_d97e725405cb["TestResponseFormatAsToolStrategy"]
  35d32d19_72c9_9082_184e_ed5e1d4d3da9 -->|defined in| d1d579f8_d411_ce75_6fa3_d97e725405cb
  a1f2424c_4432_780e_f2bc_5180a64b4040["test_dataclass()"]
  a1f2424c_4432_780e_f2bc_5180a64b4040 -->|calls| 35d32d19_72c9_9082_184e_ed5e1d4d3da9
  a1f2424c_4432_780e_f2bc_5180a64b4040["test_dataclass()"]
  35d32d19_72c9_9082_184e_ed5e1d4d3da9 -->|calls| a1f2424c_4432_780e_f2bc_5180a64b4040
  style 35d32d19_72c9_9082_184e_ed5e1d4d3da9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 254–273

    def test_dataclass(self) -> None:
        """Test response_format as ToolStrategy with dataclass."""
        tool_calls = [
            [{"args": {}, "id": "1", "name": "get_weather"}],
            [
                {
                    "name": "WeatherDataclass",
                    "id": "2",
                    "args": WEATHER_DATA,
                }
            ],
        ]

        model = FakeToolCallingModel(tool_calls=tool_calls)

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

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

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free