Reputation: 11
I am trying to use Pandas dataframe agent for data analysis a data related to cars. By default it was using OpenAI as the agent. For my use case, I had to use Cohere as the agent.
I followed this documentation https://python.langchain.com/docs/integrations/toolkits/pandas/
> Entering new AgentExecutor chain...
Thought: I can use the `shape` method to get the number of rows and columns in the dataframe.
Action: python_repl_ast
Action Input: df.shape
ObservationNameError: name 'Observation' is not defined
**Lots of code error...**
OutputParserException: Parsing LLM output produced both a final answer and a parse-able action:: Final Answer: There are 346 records in the dataframe.
Thought: I can use the `shape` method to get the number of rows and columns in the dataframe.
Action: python_repl_ast
Action Input: df.shape
Observation
During handling of the above exception, another exception occurred:
**lots of code error...**
ValueError: An output parsing error occurred. In order to pass this error back to the agent and have it try again, pass `handle_parsing_errors=True` to the AgentExecutor. This is the error: Parsing LLM output produced both a final answer and a parse-able action:: Final Answer: There are 346 records in the dataframe.
Thought: I can use the `shape` method to get the number of rows and columns in the dataframe.
Action: python_repl_ast
Action Input: df.shape
Observation
The dataset I provided had 3 rows and 11 Columns.
I tried setting agent_executor_kwargs={"handle_parsing_errors": True}
. This caused the compiler to go into some sort of loop and gives the same error at every turn. I stopped manually stopped the execution after 2 loops and this is the final error.
> Entering new AgentExecutor chain...
Thought: I can use the `shape` attribute of the dataframe to get the number of rows and columns.
Action: python_repl_ast
Action Input: df.shape
ObservationNameError: name 'Observation' is not definedParsing LLM output produced both a final answer and a parse-able action:: Final Answer: There are 346 records in the dataframe.
Thought: I can use the `shape` attribute of the dataframe to get the number of rows and columns.
Action: python_repl_ast
Action Input: df.shape
ObservationInvalid or incomplete responseThought: I can use the `shape` attribute of the dataframe to get the number of rows and columns.
Action: python_repl_ast
Action Input: df.shape
ObservationNameError: name 'Observation' is not definedThought: I can use the `shape` attribute of the dataframe to get the number of rows and columns.
Action: python_repl_ast
Action Input: df.shape
ObservationNameError: name 'Observation' is not defined
Upvotes: 1
Views: 326