-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
agent got "No I need to use a tool? No" response from llmm,which CANNOT be parsed #10572
Comments
🤖 Hello, Thank you for bringing this issue to our attention. It seems like the error you're encountering is related to the way LangChain's agent parses the output from the language model. If the language model's response includes an action that is not defined in the agent's tools, the agent will raise an error. This behavior is demonstrated in the 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 = agent("when was langchain made")
resp["intermediate_steps"][0][1] == "Foo is not a valid tool, try one of [Search]." In this test, the agent is initialized with a single tool named "Search". When the agent runs with the input "when was langchain made", the language model's response includes an action named "Foo". Since "Foo" is not a valid tool in the agent's toolset, the agent raises an error. This issue has been encountered before in the LangChain repository. Here are some similar issues that have been resolved:
Unfortunately, I couldn't find the exact error message that is being raised in your case. Could you please provide more details about the error message you're seeing? This will help us better understand the issue and find a solution. Best, Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Hi, @JxKim, I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, you raised an issue about difficulty parsing a response from a tool, and Dosubot responded with an explanation of the error, requested more details, and referenced similar resolved issues in the LangChain repository. Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, kindly let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you! |
System Info
Who can help?
No response
Information
Related Components
Reproduction
Expected behavior
DONT RAISE ERROR
The text was updated successfully, but these errors were encountered: