Open sakotham opened 3 weeks ago
so the pandas agent doesn't take in messages as input, it takes a single input string. can you try
pandas_agent.invoke({"input": query})
and see if that works?
if you want to specify the system prompt, you can do so by updating either the default system prompt via prefix
:
pandas_agent = create_pandas_dataframe_agent(
llm=self._gpt4_turbo,
df=df,
allow_dangerous_code=True,
agent_type="openai-tools",
verbose=True,
prefix="You are working with a Pandas DataFrame in Python. The name of the dataframe is `df`.\n\n" + prompt
)
Hi @baskaryan, Without Prompt part in the memory, Can I ask questions in the above format, I have implemented this memory part for the followUp questions (Bot needs to response based on the previous conversations). If this method/way is wrong is there any way to implement memory for Pandas Agent? Thank you...
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
I am using LangChain, create_pandas_dataframe_agent. intermittently I am getting the error in response tool_calls' must be followed by tool messages. But in most of the scenario this is my first question and there is no previous conversation. When I receive this tool_calls error in logs I can see NameError: name 'pd' is not defined Invoking: 'python_repl_ast' with '{'query': 'import pandas as}. All my lib are up-to date
System Info
langchain==0.2.12 langchain-community==0.2.11 langchain-core==0.2.28 langchain-experimental==0.0.64 langchain-openai==0.1.20 langchain-text-splitters==0.2.2 langsmith==0.1.98 openai==1.40.0 pandas==2.2.2