test_tool_call_id_empty_string_passed_to_callback() — langchain Function Reference
Architecture documentation for the test_tool_call_id_empty_string_passed_to_callback() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8d9ec39a_e936_276d_b056_ca07c244ccaf["test_tool_call_id_empty_string_passed_to_callback()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 8d9ec39a_e936_276d_b056_ca07c244ccaf -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 style 8d9ec39a_e936_276d_b056_ca07c244ccaf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 3428–3462
def test_tool_call_id_empty_string_passed_to_callback() -> None:
"""Test that empty string `tool_call_id` is correctly passed to callback.
Some systems may use empty strings as `tool_call_id`, and this should
be passed through correctly (not converted to `None`).
"""
@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 with empty string tool_call_id
tool_call: ToolCall = {
"name": "simple_tool",
"args": {"query": "test"},
"id": "",
"type": "tool_call",
}
result = simple_tool.invoke(tool_call, config={"callbacks": [handler]})
assert result == ToolMessage(
content="Result: test", name="simple_tool", tool_call_id=""
)
assert handler.tool_starts == 1
assert len(handler.captured_tool_call_ids) == 1
# Empty string should be passed as-is, not converted to None
assert handler.captured_tool_call_ids[0] == ""
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_tool_call_id_empty_string_passed_to_callback() do?
test_tool_call_id_empty_string_passed_to_callback() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_call_id_empty_string_passed_to_callback() defined?
test_tool_call_id_empty_string_passed_to_callback() is defined in libs/core/tests/unit_tests/test_tools.py at line 3428.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free