test_args_schema_explicitly_typed() — langchain Function Reference
Architecture documentation for the test_args_schema_explicitly_typed() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 1bdacb9b_b5a2_c146_ddc0_35d5d2f114ad["test_args_schema_explicitly_typed()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 1bdacb9b_b5a2_c146_ddc0_35d5d2f114ad -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 beffa773_a4d3_0857_9757_4deff441ad96["_get_tool_call_json_schema()"] 1bdacb9b_b5a2_c146_ddc0_35d5d2f114ad -->|calls| beffa773_a4d3_0857_9757_4deff441ad96 style 1bdacb9b_b5a2_c146_ddc0_35d5d2f114ad fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 2001–2043
def test_args_schema_explicitly_typed() -> None:
"""This should test that one can type the args schema as a Pydantic model.
Please note that this will test using pydantic 2 even though `BaseTool`
is a Pydantic 1 model!
"""
class Foo(BaseModel):
a: int
b: str
class SomeTool(BaseTool):
# type ignoring here since we're allowing overriding a type
# signature of pydantic.v1.BaseModel with pydantic.BaseModel
# for pydantic 2!
args_schema: type[BaseModel] = Foo
@override
def _run(self, *args: Any, **kwargs: Any) -> str:
return "foo"
tool = SomeTool(name="some_tool", description="some description")
assert tool.get_input_schema().model_json_schema() == {
"properties": {
"a": {"title": "A", "type": "integer"},
"b": {"title": "B", "type": "string"},
},
"required": ["a", "b"],
"title": "Foo",
"type": "object",
}
assert _get_tool_call_json_schema(tool) == {
"description": "some description",
"properties": {
"a": {"title": "A", "type": "integer"},
"b": {"title": "B", "type": "string"},
},
"required": ["a", "b"],
"title": "some_tool",
"type": "object",
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_args_schema_explicitly_typed() do?
test_args_schema_explicitly_typed() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_args_schema_explicitly_typed() defined?
test_args_schema_explicitly_typed() is defined in libs/core/tests/unit_tests/test_tools.py at line 2001.
What does test_args_schema_explicitly_typed() call?
test_args_schema_explicitly_typed() 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