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.

Function python LangChainCore Runnables calls 1 called by 2

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_response_format.py lines 179–198

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

        model = FakeToolCallingModel(tool_calls=tool_calls)

        agent = create_agent(model, [get_weather], response_format=weather_json_schema)
        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_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 179.
What does test_json_schema() call?
test_json_schema() calls 1 function(s): test_json_schema.
What calls test_json_schema()?
test_json_schema() is called by 2 function(s): test_json_schema, test_json_schema.

Analyze Your Own Codebase

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

Try Supermodel Free