You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the create_pandas_dataframe_agent with the langchain-ibm integration. Whenever I make any queries it always comes back with the error mentioned in the title. It usually falls into a loop where it tries the pandas code but is unable to answer the question because of this and just repeats the same task (or a similar version of it) over and over with no results. The thing is, when I manually try the pandas code that it says it is trying, it usually works exactly as intended. Even weirder is sometimes even though the same error is occurring, it will return the correct answer.
from langchain_experimental.agents.agent_toolkits import create_pandas_dataframe_agent
from langchain_ibm import WatsonxLLM
# Create the LLM
llm = WatsonxLLM(
model_id="",
url="",
project_id="",
params=params,
watsonx_client=client
)
df_training_agenda = pd.read_excel("fake.xlsx")
user_query = "What are the different teams?"
response = agent.run(user_query)
The output for this will look like:
> Entering new AgentExecutor chain...
Thought: I need to get the unique values from the 'Team' column.
Action: python_repl_ast
Action Input: df['Team'].unique()
ObservationNameError: name 'Observation' is not defined I need to get the unique values from the 'Team' column.
Action: python_repl_ast
Action Input: df['Team'].unique()
ObservationNameError: name 'Observation' is not defined I need to get the unique values from the 'Team' column.
Action: python_repl_ast
Action Input: df['Team'].unique()
ObservationNameError: name 'Observation' is not defined I need to get the unique values from the 'Team' column.
Action: python_repl_ast
Action Input: df['Team'].unique()
And running df['Team'].unique() with the actual df works and provides the correct answer. Does anyone have any ideas of what the issue is?
The text was updated successfully, but these errors were encountered:
Description:
I'm trying to use the create_pandas_dataframe_agent with the langchain-ibm integration. Whenever I make any queries it always comes back with the error mentioned in the title. It usually falls into a loop where it tries the pandas code but is unable to answer the question because of this and just repeats the same task (or a similar version of it) over and over with no results. The thing is, when I manually try the pandas code that it says it is trying, it usually works exactly as intended. Even weirder is sometimes even though the same error is occurring, it will return the correct answer.
I'm using:
python==3.12.7
langchain==0.3.7
langchain-community==0.3.5
langchain-core==0.3.15
langchain-experimental==0.3.3
langchain-ibm==0.3.2
langchain-text-splitters==0.3.2
langsmith==0.1.142
pandas==2.1.4
Example Code (with certain details removed):
The output for this will look like:
And running
df['Team'].unique()
with the actual df works and provides the correct answer. Does anyone have any ideas of what the issue is?The text was updated successfully, but these errors were encountered: