Pandas agent: Pass forward callback manager (#3518)

The Pandas agent fails to pass callback_manager forward, making it
impossible to use custom callbacks with it. Fix that.

Co-authored-by: Sami Liedes <sami.liedes@rocket-science.ch>
fix_agent_callbacks
Sami Liedes 1 year ago committed by GitHub
parent a08e9a3109
commit 61da2bb742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,7 +42,12 @@ def create_pandas_dataframe_agent(
callback_manager=callback_manager,
)
tool_names = [tool.name for tool in tools]
agent = ZeroShotAgent(llm_chain=llm_chain, allowed_tools=tool_names, **kwargs)
agent = ZeroShotAgent(
llm_chain=llm_chain,
allowed_tools=tool_names,
callback_manager=callback_manager,
**kwargs,
)
return AgentExecutor.from_agent_and_tools(
agent=agent,
tools=tools,
@ -51,4 +56,5 @@ def create_pandas_dataframe_agent(
max_iterations=max_iterations,
max_execution_time=max_execution_time,
early_stopping_method=early_stopping_method,
callback_manager=callback_manager,
)

Loading…
Cancel
Save