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