Home / Function/ test_tool_field_description_preserved() — langchain Function Reference

test_tool_field_description_preserved() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0db4d399_67fe_43db_e2c7_5830e2a51f9b["test_tool_field_description_preserved()"]
  8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"]
  0db4d399_67fe_43db_e2c7_5830e2a51f9b -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555
  style 0db4d399_67fe_43db_e2c7_5830e2a51f9b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 1422–1452

def test_tool_field_description_preserved() -> None:
    """Test that `Field(description=...)` is preserved in `@tool` decorator."""

    @tool
    def my_tool(
        topic: Annotated[str, Field(description="The research topic")],
        depth: Annotated[int, Field(description="Search depth level")] = 3,
    ) -> str:
        """A tool for research."""
        return f"{topic} at depth {depth}"

    args_schema = _schema(my_tool.args_schema)
    assert args_schema == {
        "title": "my_tool",
        "type": "object",
        "description": "A tool for research.",
        "properties": {
            "topic": {
                "title": "Topic",
                "type": "string",
                "description": "The research topic",
            },
            "depth": {
                "title": "Depth",
                "type": "integer",
                "description": "Search depth level",
                "default": 3,
            },
        },
        "required": ["topic"],
    }

Domain

Subdomains

Frequently Asked Questions

What does test_tool_field_description_preserved() do?
test_tool_field_description_preserved() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_field_description_preserved() defined?
test_tool_field_description_preserved() is defined in libs/core/tests/unit_tests/test_tools.py at line 1422.

Analyze Your Own Codebase

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

Try Supermodel Free