Home / Function/ test_tool_args_schema_pydantic_v2_with_metadata() — langchain Function Reference

test_tool_args_schema_pydantic_v2_with_metadata() — langchain Function Reference

Architecture documentation for the test_tool_args_schema_pydantic_v2_with_metadata() function in test_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c4784546_78c4_7d10_72d9_6bd529eb66b3["test_tool_args_schema_pydantic_v2_with_metadata()"]
  8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"]
  c4784546_78c4_7d10_72d9_6bd529eb66b3 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555
  beffa773_a4d3_0857_9757_4deff441ad96["_get_tool_call_json_schema()"]
  c4784546_78c4_7d10_72d9_6bd529eb66b3 -->|calls| beffa773_a4d3_0857_9757_4deff441ad96
  b621c544_d6db_7e8d_7240_9ce08870d71a["foo()"]
  c4784546_78c4_7d10_72d9_6bd529eb66b3 -->|calls| b621c544_d6db_7e8d_7240_9ce08870d71a
  style c4784546_78c4_7d10_72d9_6bd529eb66b3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 2325–2355

def test_tool_args_schema_pydantic_v2_with_metadata() -> None:
    class Foo(BaseModel):
        x: list[int] = Field(
            description="List of integers", min_length=10, max_length=15
        )

    @tool(args_schema=Foo)
    def foo(x) -> list[int]:  # type: ignore[no-untyped-def] # noqa: ANN001
        """Foo."""
        return x  # type: ignore[no-any-return]

    assert _get_tool_call_json_schema(foo) == {
        "description": "Foo.",
        "properties": {
            "x": {
                "description": "List of integers",
                "items": {"type": "integer"},
                "maxItems": 15,
                "minItems": 10,
                "title": "X",
                "type": "array",
            }
        },
        "required": ["x"],
        "title": "foo",
        "type": "object",
    }

    assert foo.invoke({"x": [0] * 10})
    with pytest.raises(ValidationError):
        foo.invoke({"x": [0] * 9})

Domain

Subdomains

Frequently Asked Questions

What does test_tool_args_schema_pydantic_v2_with_metadata() do?
test_tool_args_schema_pydantic_v2_with_metadata() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_args_schema_pydantic_v2_with_metadata() defined?
test_tool_args_schema_pydantic_v2_with_metadata() is defined in libs/core/tests/unit_tests/test_tools.py at line 2325.
What does test_tool_args_schema_pydantic_v2_with_metadata() call?
test_tool_args_schema_pydantic_v2_with_metadata() calls 2 function(s): _get_tool_call_json_schema, foo.

Analyze Your Own Codebase

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

Try Supermodel Free