Home / Function/ test_json_schema() — langchain Function Reference

test_json_schema() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  209cba78_883a_6489_8dba_7f596b2fae90["test_json_schema()"]
  ab8da393_2432_e6a3_7963_47ccc7b82fac["TestResponseFormatAsProviderStrategy"]
  209cba78_883a_6489_8dba_7f596b2fae90 -->|defined in| ab8da393_2432_e6a3_7963_47ccc7b82fac
  3a19584d_56f8_f36c_495e_d0a23bd1d48b["test_json_schema()"]
  209cba78_883a_6489_8dba_7f596b2fae90 -->|calls| 3a19584d_56f8_f36c_495e_d0a23bd1d48b
  style 209cba78_883a_6489_8dba_7f596b2fae90 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 770–786

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

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

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

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

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free