Skip to content
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

React Agents sometimes fail if they only have one tool #998

Closed
bborn opened this issue Feb 12, 2023 · 3 comments
Closed

React Agents sometimes fail if they only have one tool #998

bborn opened this issue Feb 12, 2023 · 3 comments

Comments

@bborn
Copy link
Contributor

bborn commented Feb 12, 2023

I've seen this a few times: if an agent only has one tool, it will sometimes do this:

Action Input: Some input
Observation: [Tool Name] is not a valid tool

I think it's getting confused because the list of available tools only has one item, so it thinks the entire tool is called [Tool Name] instead of Tool Name

(And sorry for saying "thinks" - I know it doesn't think but it just sort of makes sense to describe it that way)

hwchase17 pushed a commit that referenced this issue Mar 1, 2023
[InvalidTool.run()](https://github.com/hwchase17/langchain/blob/72ef69d1ba33f052bf3948c1e1d7d6441b14af0a/langchain/agents/tools.py#L43)
returns "{arg}is not a valid tool, try another one.".
However, no function name is actually given in the argument.
This causes LLM to be stuck in a loop, unable to find the right tool.

This may resolve these Issues.
#998
#702
@chris-aeviator
Copy link

this reliably happens to me if only one tool is present

zachschillaci27 pushed a commit to zachschillaci27/langchain that referenced this issue Mar 8, 2023
[InvalidTool.run()](https://github.com/hwchase17/langchain/blob/72ef69d1ba33f052bf3948c1e1d7d6441b14af0a/langchain/agents/tools.py#L43)
returns "{arg}is not a valid tool, try another one.".
However, no function name is actually given in the argument.
This causes LLM to be stuck in a loop, unable to find the right tool.

This may resolve these Issues.
langchain-ai#998
langchain-ai#702
mikeknoop pushed a commit to zapier/langchain-nla-util that referenced this issue Mar 9, 2023
[InvalidTool.run()](https://github.com/hwchase17/langchain/blob/aa7e6ae88e1aa6777bc018fcb7f185bb6f1b6f21/langchain/agents/tools.py#L43)
returns "{arg}is not a valid tool, try another one.".
However, no function name is actually given in the argument.
This causes LLM to be stuck in a loop, unable to find the right tool.

This may resolve these Issues.
langchain-ai/langchain#998
langchain-ai/langchain#702
@sonnguyen-TS
Copy link

This also happens to me when I use only one tool (PythonREPLTool). The chain doesn't recognise it and assign to "Invalid tool". When I add an extra tool like Wikipedia, the the problem's solved.

@dosubot
Copy link

dosubot bot commented Oct 21, 2023

Hi, @bborn! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

Based on my understanding, the issue you reported is about React Agents failing when they only have one tool because the list of available tools is not being handled correctly. It seems that chris-aeviator, mikeyang01, and sonnguyen-TS have also experienced this issue. Sonnguyen-TS found that adding an extra tool resolved the problem.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution to LangChain!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 21, 2023
@bborn bborn closed this as completed Oct 21, 2023
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants