From 6c629b54e6b576c444108007273d950af6f7c0b6 Mon Sep 17 00:00:00 2001 From: kurehajime Date: Wed, 1 Mar 2023 11:58:23 +0900 Subject: [PATCH] Fixed arguments passed to InvalidTool.run(). (#1340) [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. https://github.com/hwchase17/langchain/issues/998 https://github.com/hwchase17/langchain/issues/702 --- langchain/agents/agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langchain/agents/agent.py b/langchain/agents/agent.py index 5b5a5c76..6fd6d875 100644 --- a/langchain/agents/agent.py +++ b/langchain/agents/agent.py @@ -426,7 +426,7 @@ class AgentExecutor(Chain, BaseModel): ) else: observation = InvalidTool().run( - output.tool_input, + output.tool, verbose=self.verbose, color=None, llm_prefix="", @@ -473,7 +473,7 @@ class AgentExecutor(Chain, BaseModel): ) else: observation = await InvalidTool().arun( - output.tool_input, + output.tool, verbose=self.verbose, color=None, llm_prefix="",