Home / Function/ test_structured_tool_from_function_docstring_complex_args() — langchain Function Reference

test_structured_tool_from_function_docstring_complex_args() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 482–521

def test_structured_tool_from_function_docstring_complex_args() -> None:
    """Test that structured tools can be created from functions."""

    def foo(bar: int, baz: list[str]) -> str:
        """Docstring.

        Args:
            bar: int
            baz: list[str]
        """
        raise NotImplementedError

    structured_tool = StructuredTool.from_function(foo)
    assert structured_tool.name == "foo"
    assert structured_tool.args == {
        "bar": {"title": "Bar", "type": "integer"},
        "baz": {
            "title": "Baz",
            "type": "array",
            "items": {"type": "string"},
        },
    }

    assert _schema(structured_tool.args_schema) == {
        "properties": {
            "bar": {"title": "Bar", "type": "integer"},
            "baz": {
                "title": "Baz",
                "type": "array",
                "items": {"type": "string"},
            },
        },
        "description": inspect.getdoc(foo),
        "title": "foo",
        "type": "object",
        "required": ["bar", "baz"],
    }

    assert foo.__doc__ is not None
    assert structured_tool.description == textwrap.dedent(foo.__doc__).strip()

Domain

Subdomains

Calls

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free