test_structured_tool_types_parsed_pydantic_v1() — langchain Function Reference
Architecture documentation for the test_structured_tool_types_parsed_pydantic_v1() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 59071154_3fdf_e94a_26ea_f68a9669ff84["test_structured_tool_types_parsed_pydantic_v1()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 59071154_3fdf_e94a_26ea_f68a9669ff84 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 style 59071154_3fdf_e94a_26ea_f68a9669ff84 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 371–394
def test_structured_tool_types_parsed_pydantic_v1() -> None:
"""Test the non-primitive types are correctly passed to structured tools."""
class SomeBaseModel(BaseModelV1):
foo: str
class AnotherBaseModel(BaseModelV1):
bar: str
@tool
def structured_tool(some_base_model: SomeBaseModel) -> AnotherBaseModel:
"""Return the arguments directly."""
return AnotherBaseModel(bar=some_base_model.foo)
assert isinstance(structured_tool, StructuredTool)
expected = AnotherBaseModel(bar="baz")
for arg in [
SomeBaseModel(foo="baz"),
SomeBaseModel(foo="baz").dict(),
]:
args = {"some_base_model": arg}
result = structured_tool.run(args)
assert result == expected
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_structured_tool_types_parsed_pydantic_v1() do?
test_structured_tool_types_parsed_pydantic_v1() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_structured_tool_types_parsed_pydantic_v1() defined?
test_structured_tool_types_parsed_pydantic_v1() is defined in libs/core/tests/unit_tests/test_tools.py at line 371.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free