test_tool_call_id_none_when_invoked_without_tool_call() — langchain Function Reference
Architecture documentation for the test_tool_call_id_none_when_invoked_without_tool_call() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 41fc1979_9484_ec49_3680_31d5027f429f["test_tool_call_id_none_when_invoked_without_tool_call()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 41fc1979_9484_ec49_3680_31d5027f429f -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 style 41fc1979_9484_ec49_3680_31d5027f429f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 3400–3425
def test_tool_call_id_none_when_invoked_without_tool_call() -> None:
"""Test that `tool_call_id` is `None` when tool is invoked without a `ToolCall`.
When a tool is invoked directly with arguments (not via a `ToolCall`),
the `tool_call_id` should be `None` in the 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=[])
# Invoke tool directly with arguments, not a ToolCall
result = simple_tool.invoke({"query": "test"}, config={"callbacks": [handler]})
assert result == "Result: test"
assert handler.tool_starts == 1
assert len(handler.captured_tool_call_ids) == 1
# tool_call_id should be None when not invoked with a ToolCall
assert handler.captured_tool_call_ids[0] is None
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_tool_call_id_none_when_invoked_without_tool_call() do?
test_tool_call_id_none_when_invoked_without_tool_call() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_call_id_none_when_invoked_without_tool_call() defined?
test_tool_call_id_none_when_invoked_without_tool_call() is defined in libs/core/tests/unit_tests/test_tools.py at line 3400.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free