test_tool_with_kwargs() — langchain Function Reference
Architecture documentation for the test_tool_with_kwargs() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 1a0d5585_7eb2_1ffd_510a_05f7a0e74649["test_tool_with_kwargs()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 1a0d5585_7eb2_1ffd_510a_05f7a0e74649 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 style 1a0d5585_7eb2_1ffd_510a_05f7a0e74649 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 687–717
def test_tool_with_kwargs() -> None:
"""Test functionality when only return direct is provided."""
@tool(return_direct=True)
def search_api(
arg_0: str,
arg_1: float = 4.3,
ping: str = "hi",
) -> str:
"""Search the API for the query."""
return f"arg_0={arg_0}, arg_1={arg_1}, ping={ping}"
assert isinstance(search_api, BaseTool)
result = search_api.run(
tool_input={
"arg_0": "foo",
"arg_1": 3.2,
"ping": "pong",
}
)
assert result == "arg_0=foo, arg_1=3.2, ping=pong"
result = search_api.run(
tool_input={
"arg_0": "foo",
}
)
assert result == "arg_0=foo, arg_1=4.3, ping=hi"
# For backwards compatibility, we still accept a single str arg
result = search_api.run("foobar")
assert result == "arg_0=foobar, arg_1=4.3, ping=hi"
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_tool_with_kwargs() do?
test_tool_with_kwargs() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_with_kwargs() defined?
test_tool_with_kwargs() is defined in libs/core/tests/unit_tests/test_tools.py at line 687.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free