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

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 732–750

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

        model = FakeToolCallingModel(
            tool_calls=tool_calls, structured_response=EXPECTED_WEATHER_DATACLASS
        )

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

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

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 732.
What does test_dataclass() call?
test_dataclass() calls 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