test_tool_call_id_passed_to_on_tool_start_callback() — langchain Function Reference
Architecture documentation for the test_tool_call_id_passed_to_on_tool_start_callback() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 67404c6b_4fc9_78e3_f77d_2e3fa376276a["test_tool_call_id_passed_to_on_tool_start_callback()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 67404c6b_4fc9_78e3_f77d_2e3fa376276a -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 style 67404c6b_4fc9_78e3_f77d_2e3fa376276a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 3366–3397
async def test_tool_call_id_passed_to_on_tool_start_callback(method: str) -> None:
"""Test that `tool_call_id` is passed to the `on_tool_start` callback."""
@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=[])
tool_call: ToolCall = {
"name": "simple_tool",
"args": {"query": "test"},
"id": "test_tool_call_id_123",
"type": "tool_call",
}
if method == "ainvoke":
result = await simple_tool.ainvoke(tool_call, config={"callbacks": [handler]})
else:
result = simple_tool.invoke(tool_call, config={"callbacks": [handler]})
assert result == ToolMessage(
content="Result: test", name="simple_tool", tool_call_id="test_tool_call_id_123"
)
assert handler.tool_starts == 1
assert len(handler.captured_tool_call_ids) == 1
assert handler.captured_tool_call_ids[0] == "test_tool_call_id_123"
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_tool_call_id_passed_to_on_tool_start_callback() do?
test_tool_call_id_passed_to_on_tool_start_callback() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_call_id_passed_to_on_tool_start_callback() defined?
test_tool_call_id_passed_to_on_tool_start_callback() is defined in libs/core/tests/unit_tests/test_tools.py at line 3366.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free