langchain: ValueError: ZeroShotAgent does not support multi-input tool Calculator.
There is an error when i tried to use this code.
tools = load_tools(['llm-math', 'python_repl'], llm)
agent = initialize_agent(tools, agent="zero-shot-react-description", llm=llm)
Looks like because of #3684 checking if len(self.args) == 1: in self.is_single_input. But, self.args of llm-math is
{'args': {'title': 'Args', 'type': 'array', 'items': {}},
'kwargs': {'title': 'Kwargs', 'type': 'object'}}
So, self.is_single_input return False
Is there a way to get single input llm-math?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 29 (10 by maintainers)
Commits related to this issue
- Fix exemplar loading See: https://github.com/langchain-ai/langchain/issues/3700#issuecomment-1568735481 — committed to DrJKevan/EngageBot by figureone 10 months ago
Hi @BankNatchapol
I think its related to the recent releases.
Installing v0.0.147 would resolve the issue. Do the following
In the meantime someone needs to fix this bug.
I’ve had the same problem with all agent types. The _validate_tools method is the problem. Commenting out this line, the agent resumes work: https://github.com/hwchase17/langchain/blob/v0.0.152/langchain/agents/agent.py#L478
I still can’t figure out why. Does anyone know why the agent shouldn’t support a multiple input tool?
I tried with ConversationalAgent with a RetrivalQA tool that needs {context} and {quary} inputs.
Got it. As a new user, it was not immediately clear which agents were the right ones to use. Maybe the old ones should print a deprecation warning if they are used?
I don’t quite understand why the multi-input tools are supposed to not work with the older agents. They were working before, and are still working fine with this quick hack that just turns the validation into a no-op:
Out of curiosity @vowelparrot, why do you say that they don’t work? The new structured tools look cool, but afaict I can’t use them yet, since my use case requires a chat agent with a conversation history, and the only new structured tool
STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
doesn’t support chat history.Thanks for your help. It is not working as expected with AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
As it does not use my API even when I prompt it otherwise by modifying the template.
I have downgraded langchain to v0.0.147 for now.
I created a PR here that removes the restrictive checking of multi-input in the Agent base class. Will need reviewers to +1 and merge.
I am seeing this issue in the latest version (langchain==0.0.216). Why was this issue closed?
EDIT: It looks like using a different AgentType works.
agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
Thanks, I was writing a custom tool that takes multiple arguments and calls an API. I am using the agent:
'chat-conversational-react-description'
What am I doing wrong?
As a LangChain newcomer, I just got hit by this one as well.
The tools documentation shows examples of multi-input tools without mentioning agent types (e.g. here).
Ok so which agent should I use then? Any examples?