bhancockio / langchain-crash-course

216 stars 175 forks source link

5_agents_and_tools/agent_deep_dive/1_agent_react_chat.py #2

Open stutimishra7 opened 1 month ago

stutimishra7 commented 1 month ago

User: what is the time

Entering new AgentExecutor chain... Action:

{
"action": "Time",
"action_input": {}
}

ToolException Traceback (most recent call last) in <cell line: 87>() 94 95 # Invoke the agent with the user input and the current chat history ---> 96 response = agent_executor.invoke({"input": user_input}) 97 # print(response) 98 print("Bot:", response["output"])

9 frames /usr/local/lib/python3.10/dist-packages/langchain_core/tools.py in _to_args_and_kwargs(self, tool_input) 723 all_args = list(args) + list(kwargs.values()) 724 if len(all_args) != 1: --> 725 raise ToolException( 726 f"""Too many arguments to single-input tool {self.name}. 727 Consider using StructuredTool instead."""

ToolException: Too many arguments to single-input tool Time. Consider using StructuredTool instead. Args: []

stutimishra7 commented 1 month ago

Working for Wikipedia

Jiaqin-Tan commented 1 week ago

It seems to be caused by the LLM update, someone please confirm this.

Also it can be luck based, if the LLM think there is only 1 arg to be passed in, then the code should running fine.