mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-06 13:18:12 +00:00
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>
This commit is contained in:
parent
a08e9a3109
commit
61da2bb742
@ -42,7 +42,12 @@ def create_pandas_dataframe_agent(
|
|||||||
callback_manager=callback_manager,
|
callback_manager=callback_manager,
|
||||||
)
|
)
|
||||||
tool_names = [tool.name for tool in tools]
|
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(
|
return AgentExecutor.from_agent_and_tools(
|
||||||
agent=agent,
|
agent=agent,
|
||||||
tools=tools,
|
tools=tools,
|
||||||
@ -51,4 +56,5 @@ def create_pandas_dataframe_agent(
|
|||||||
max_iterations=max_iterations,
|
max_iterations=max_iterations,
|
||||||
max_execution_time=max_execution_time,
|
max_execution_time=max_execution_time,
|
||||||
early_stopping_method=early_stopping_method,
|
early_stopping_method=early_stopping_method,
|
||||||
|
callback_manager=callback_manager,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user