test_structured_tool_args_schema_dict() — langchain Function Reference
Architecture documentation for the test_structured_tool_args_schema_dict() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD bdb2a8b3_d7f4_9eb2_8272_89edcd9bb363["test_structured_tool_args_schema_dict()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] bdb2a8b3_d7f4_9eb2_8272_89edcd9bb363 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 beffa773_a4d3_0857_9757_4deff441ad96["_get_tool_call_json_schema()"] bdb2a8b3_d7f4_9eb2_8272_89edcd9bb363 -->|calls| beffa773_a4d3_0857_9757_4deff441ad96 style bdb2a8b3_d7f4_9eb2_8272_89edcd9bb363 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 2634–2667
def test_structured_tool_args_schema_dict() -> None:
args_schema = {
"properties": {
"a": {"title": "A", "type": "integer"},
"b": {"title": "B", "type": "integer"},
},
"required": ["a", "b"],
"title": "add",
"type": "object",
"description": "add two numbers",
}
tool = StructuredTool(
name="add",
args_schema=args_schema,
func=lambda a, b: a + b,
)
assert tool.invoke({"a": 1, "b": 2}) == 3
assert tool.args_schema == args_schema
# test that the tool call schema is the same as the args schema
assert _get_tool_call_json_schema(tool) == args_schema
# test that the input schema is the same as the parent (Runnable) input schema
assert (
tool.get_input_schema().model_json_schema()
== create_model_v2(
tool.get_name("Input"),
root=tool.InputType,
module_name=tool.__class__.__module__,
).model_json_schema()
)
# test that args are extracted correctly
assert tool.args == {
"a": {"title": "A", "type": "integer"},
"b": {"title": "B", "type": "integer"},
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_structured_tool_args_schema_dict() do?
test_structured_tool_args_schema_dict() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_structured_tool_args_schema_dict() defined?
test_structured_tool_args_schema_dict() is defined in libs/core/tests/unit_tests/test_tools.py at line 2634.
What does test_structured_tool_args_schema_dict() call?
test_structured_tool_args_schema_dict() calls 1 function(s): _get_tool_call_json_schema.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free