mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-13 16:36:06 +00:00
`run_manager` was not being passed downstream. Not sure if this was a deliberate choice but it seems like it broke many agent callbacks like `agent_action` and `agent_finish`. This fix needs a proper review. Co-authored-by: blob42 <spike@w530>
This commit is contained in:
parent
6032a051e9
commit
878d0c8155
@ -957,7 +957,11 @@ class AgentExecutor(Chain):
|
|||||||
run_manager=run_manager,
|
run_manager=run_manager,
|
||||||
)
|
)
|
||||||
if isinstance(next_step_output, AgentFinish):
|
if isinstance(next_step_output, AgentFinish):
|
||||||
return await self._areturn(next_step_output, intermediate_steps)
|
return await self._areturn(
|
||||||
|
next_step_output,
|
||||||
|
intermediate_steps,
|
||||||
|
run_manager=run_manager,
|
||||||
|
)
|
||||||
|
|
||||||
intermediate_steps.extend(next_step_output)
|
intermediate_steps.extend(next_step_output)
|
||||||
if len(next_step_output) == 1:
|
if len(next_step_output) == 1:
|
||||||
@ -965,7 +969,9 @@ class AgentExecutor(Chain):
|
|||||||
# See if tool should return directly
|
# See if tool should return directly
|
||||||
tool_return = self._get_tool_return(next_step_action)
|
tool_return = self._get_tool_return(next_step_action)
|
||||||
if tool_return is not None:
|
if tool_return is not None:
|
||||||
return await self._areturn(tool_return, intermediate_steps)
|
return await self._areturn(
|
||||||
|
tool_return, intermediate_steps, run_manager=run_manager
|
||||||
|
)
|
||||||
|
|
||||||
iterations += 1
|
iterations += 1
|
||||||
time_elapsed = time.time() - start_time
|
time_elapsed = time.time() - start_time
|
||||||
@ -980,7 +986,9 @@ class AgentExecutor(Chain):
|
|||||||
output = self.agent.return_stopped_response(
|
output = self.agent.return_stopped_response(
|
||||||
self.early_stopping_method, intermediate_steps, **inputs
|
self.early_stopping_method, intermediate_steps, **inputs
|
||||||
)
|
)
|
||||||
return await self._areturn(output, intermediate_steps)
|
return await self._areturn(
|
||||||
|
output, intermediate_steps, run_manager=run_manager
|
||||||
|
)
|
||||||
|
|
||||||
def _get_tool_return(
|
def _get_tool_return(
|
||||||
self, next_step_output: Tuple[AgentAction, str]
|
self, next_step_output: Tuple[AgentAction, str]
|
||||||
|
Loading…
Reference in New Issue
Block a user