test_structured_tool_from_function() — langchain Function Reference
Architecture documentation for the test_structured_tool_from_function() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b1f79d5c_e805_1836_a4fd_1ed136b9e918["test_structured_tool_from_function()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] b1f79d5c_e805_1836_a4fd_1ed136b9e918 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 b621c544_d6db_7e8d_7240_9ce08870d71a["foo()"] b1f79d5c_e805_1836_a4fd_1ed136b9e918 -->|calls| b621c544_d6db_7e8d_7240_9ce08870d71a style b1f79d5c_e805_1836_a4fd_1ed136b9e918 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 848–879
def test_structured_tool_from_function() -> None:
"""Test that structured tools can be created from functions."""
def foo(bar: int, baz: str) -> str:
"""Docstring thing.
Args:
bar: the bar value
baz: the baz value
"""
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": "string"},
}
assert _schema(structured_tool.args_schema) == {
"title": "foo",
"type": "object",
"description": inspect.getdoc(foo),
"properties": {
"bar": {"title": "Bar", "type": "integer"},
"baz": {"title": "Baz", "type": "string"},
},
"required": ["bar", "baz"],
}
assert foo.__doc__ is not None
assert structured_tool.description == textwrap.dedent(foo.__doc__.strip())
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does test_structured_tool_from_function() do?
test_structured_tool_from_function() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_structured_tool_from_function() defined?
test_structured_tool_from_function() is defined in libs/core/tests/unit_tests/test_tools.py at line 848.
What does test_structured_tool_from_function() call?
test_structured_tool_from_function() 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