test_tool_search_with_deferred_tools() — langchain Function Reference
Architecture documentation for the test_tool_search_with_deferred_tools() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e3460040_e1e4_ace7_497f_c0c865e75ea7["test_tool_search_with_deferred_tools()"] 18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"] e3460040_e1e4_ace7_497f_c0c865e75ea7 -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311 style e3460040_e1e4_ace7_497f_c0c865e75ea7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1875–1920
def test_tool_search_with_deferred_tools() -> None:
"""Test that `defer_loading` works correctly with tool search."""
llm = ChatAnthropic(
model="claude-opus-4-5-20251101", # type: ignore[call-arg]
)
# Create tools with defer_loading
tools = [
{
"type": "tool_search_tool_bm25_20251119",
"name": "tool_search_tool_bm25",
},
{
"name": "calculator",
"description": "Perform mathematical calculations",
"input_schema": {
"type": "object",
"properties": {
"expression": {
"type": "string",
"description": "Mathematical expression",
},
},
"required": ["expression"],
},
"defer_loading": True,
},
]
llm_with_tools = llm.bind_tools(tools) # type: ignore[arg-type]
# Verify the payload includes tools with defer_loading
payload = llm_with_tools._get_request_payload( # type: ignore[attr-defined]
"test",
**llm_with_tools.kwargs, # type: ignore[attr-defined]
)
# Find the calculator tool in the payload
calculator_tool = None
for tool in payload["tools"]:
if isinstance(tool, dict) and tool.get("name") == "calculator":
calculator_tool = tool
break
assert calculator_tool is not None
assert calculator_tool.get("defer_loading") is True
Domain
Subdomains
Source
Frequently Asked Questions
What does test_tool_search_with_deferred_tools() do?
test_tool_search_with_deferred_tools() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py.
Where is test_tool_search_with_deferred_tools() defined?
test_tool_search_with_deferred_tools() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 1875.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free