Fixed arguments passed to InvalidTool.run(). (#1340)

[InvalidTool.run()](72ef69d1ba/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
This commit is contained in:
kurehajime 2023-03-01 11:58:23 +09:00 committed by GitHub
parent 3574418a40
commit 6c629b54e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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="",