test_tool_call_id_passed_via_run_method() — langchain Function Reference
Architecture documentation for the test_tool_call_id_passed_via_run_method() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 54da73f5_43c7_6b5b_85ed_cbf0feef7829["test_tool_call_id_passed_via_run_method()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 54da73f5_43c7_6b5b_85ed_cbf0feef7829 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 style 54da73f5_43c7_6b5b_85ed_cbf0feef7829 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 3466–3505
async def test_tool_call_id_passed_via_run_method(method: str) -> None:
"""Test that `tool_call_id` is passed to callback when using run/arun method.
The `run()` and `arun()` methods are the lower-level APIs that `invoke()`
and `ainvoke()` call internally. This test ensures `tool_call_id` works
at this level as well.
"""
@tool
def simple_tool(query: str) -> str:
"""Simple tool for testing.
Args:
query: The query string.
"""
return f"Result: {query}"
handler = CallbackHandlerWithToolCallIdCapture(captured_tool_call_ids=[])
if method == "arun":
result = await simple_tool.arun(
{"query": "test"},
callbacks=[handler],
tool_call_id="run_method_tool_call_id",
)
else:
result = simple_tool.run(
{"query": "test"},
callbacks=[handler],
tool_call_id="run_method_tool_call_id",
)
assert result == ToolMessage(
content="Result: test",
name="simple_tool",
tool_call_id="run_method_tool_call_id",
)
assert handler.tool_starts == 1
assert len(handler.captured_tool_call_ids) == 1
assert handler.captured_tool_call_ids[0] == "run_method_tool_call_id"
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_tool_call_id_passed_via_run_method() do?
test_tool_call_id_passed_via_run_method() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_call_id_passed_via_run_method() defined?
test_tool_call_id_passed_via_run_method() is defined in libs/core/tests/unit_tests/test_tools.py at line 3466.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free