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
  a1f2424c_4432_780e_f2bc_5180a64b4040["test_dataclass()"]
  5b61036b_6078_395b_d306_03640f401013["TestResponseFormatAsModel"]
  a1f2424c_4432_780e_f2bc_5180a64b4040 -->|defined in| 5b61036b_6078_395b_d306_03640f401013
  35d32d19_72c9_9082_184e_ed5e1d4d3da9["test_dataclass()"]
  35d32d19_72c9_9082_184e_ed5e1d4d3da9 -->|calls| a1f2424c_4432_780e_f2bc_5180a64b4040
  8fc9f189_a950_13c2_aba8_0b5c6642e04d["test_dataclass()"]
  8fc9f189_a950_13c2_aba8_0b5c6642e04d -->|calls| a1f2424c_4432_780e_f2bc_5180a64b4040
  35d32d19_72c9_9082_184e_ed5e1d4d3da9["test_dataclass()"]
  a1f2424c_4432_780e_f2bc_5180a64b4040 -->|calls| 35d32d19_72c9_9082_184e_ed5e1d4d3da9
  style a1f2424c_4432_780e_f2bc_5180a64b4040 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 137–156

    def test_dataclass(self) -> None:
        """Test response_format as 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=WeatherDataclass)
        response = agent.invoke({"messages": [HumanMessage("What's the weather?")]})

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

Domain

Subdomains

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 137.
What does test_dataclass() call?
test_dataclass() calls 1 function(s): test_dataclass.
What calls test_dataclass()?
test_dataclass() is called by 2 function(s): test_dataclass, test_dataclass.

Analyze Your Own Codebase

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

Try Supermodel Free