Home / Function/ test_typed_dict() — langchain Function Reference

test_typed_dict() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  af9e7681_f120_a3f3_f3cb_98c627af8e9d["test_typed_dict()"]
  5b61036b_6078_395b_d306_03640f401013["TestResponseFormatAsModel"]
  af9e7681_f120_a3f3_f3cb_98c627af8e9d -->|defined in| 5b61036b_6078_395b_d306_03640f401013
  649be7e4_4a1f_594b_53af_73c143bd2710["test_typed_dict()"]
  649be7e4_4a1f_594b_53af_73c143bd2710 -->|calls| af9e7681_f120_a3f3_f3cb_98c627af8e9d
  b3705022_dc43_a898_a2cd_673c954416b8["test_typed_dict()"]
  b3705022_dc43_a898_a2cd_673c954416b8 -->|calls| af9e7681_f120_a3f3_f3cb_98c627af8e9d
  649be7e4_4a1f_594b_53af_73c143bd2710["test_typed_dict()"]
  af9e7681_f120_a3f3_f3cb_98c627af8e9d -->|calls| 649be7e4_4a1f_594b_53af_73c143bd2710
  style af9e7681_f120_a3f3_f3cb_98c627af8e9d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 158–177

    def test_typed_dict(self) -> None:
        """Test response_format as TypedDict."""
        tool_calls = [
            [{"args": {}, "id": "1", "name": "get_weather"}],
            [
                {
                    "name": "WeatherTypedDict",
                    "id": "2",
                    "args": WEATHER_DATA,
                }
            ],
        ]

        model = FakeToolCallingModel(tool_calls=tool_calls)

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

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

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free