adding agent step callback

This commit is contained in:
João Moura
2024-02-08 23:01:30 -08:00
parent 0057ed6786
commit f63d4edbb4
3 changed files with 13 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ class CrewAgentExecutor(AgentExecutor):
request_within_rpm_limit: Any = None
max_iterations: Optional[int] = 15
force_answer_max_iterations: Optional[int] = None
step_callback: Optional[Any] = None
@root_validator()
def set_force_answer_max_iterations(cls, values: Dict) -> Dict:
@@ -67,7 +68,7 @@ class CrewAgentExecutor(AgentExecutor):
return self._return(
next_step_output, intermediate_steps, run_manager=run_manager
)
self.step_callback(next_step_output)
intermediate_steps.extend(next_step_output)
if len(next_step_output) == 1:
next_step_action = next_step_output[0]