test_agent_invalid_tool() — langchain Function Reference
Architecture documentation for the test_agent_invalid_tool() function in test_agent_async.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 35a065d1_a2e3_b9f5_74f3_3f7003e13226["test_agent_invalid_tool()"] 663245d2_2254_328f_5cf8_4bbd36fb32cc["test_agent_async.py"] 35a065d1_a2e3_b9f5_74f3_3f7003e13226 -->|defined in| 663245d2_2254_328f_5cf8_4bbd36fb32cc style 35a065d1_a2e3_b9f5_74f3_3f7003e13226 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_agent_async.py lines 344–367
async def test_agent_invalid_tool() -> None:
"""Test agent invalid tool and correct suggestions."""
fake_llm = FakeListLLM(responses=["FooBarBaz\nAction: Foo\nAction Input: Bar"])
tools = [
Tool(
name="Search",
func=lambda x: x,
description="Useful for searching",
return_direct=True,
),
]
agent = initialize_agent(
tools=tools,
llm=fake_llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
return_intermediate_steps=True,
max_iterations=1,
)
resp = await agent.acall("when was langchain made")
assert (
resp["intermediate_steps"][0][1]
== "Foo is not a valid tool, try one of [Search]."
)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_agent_invalid_tool() do?
test_agent_invalid_tool() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py.
Where is test_agent_invalid_tool() defined?
test_agent_invalid_tool() is defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py at line 344.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free