Remove no executed result (#417)
This commit is contained in:
@@ -621,7 +621,7 @@ class ForgeAgent:
|
|||||||
status=StepStatus.failed,
|
status=StepStatus.failed,
|
||||||
output=detailed_agent_step_output.to_agent_step_output(),
|
output=detailed_agent_step_output.to_agent_step_output(),
|
||||||
)
|
)
|
||||||
return failed_step, detailed_agent_step_output
|
return failed_step, detailed_agent_step_output.get_clean_detailed_output()
|
||||||
|
|
||||||
LOG.info(
|
LOG.info(
|
||||||
"Actions executed successfully, marking step as completed",
|
"Actions executed successfully, marking step as completed",
|
||||||
@@ -637,7 +637,7 @@ class ForgeAgent:
|
|||||||
status=StepStatus.completed,
|
status=StepStatus.completed,
|
||||||
output=detailed_agent_step_output.to_agent_step_output(),
|
output=detailed_agent_step_output.to_agent_step_output(),
|
||||||
)
|
)
|
||||||
return completed_step, detailed_agent_step_output
|
return completed_step, detailed_agent_step_output.get_clean_detailed_output()
|
||||||
except CancelledError:
|
except CancelledError:
|
||||||
LOG.exception(
|
LOG.exception(
|
||||||
"CancelledError in agent_step, marking step as failed",
|
"CancelledError in agent_step, marking step as failed",
|
||||||
@@ -651,7 +651,7 @@ class ForgeAgent:
|
|||||||
status=StepStatus.failed,
|
status=StepStatus.failed,
|
||||||
output=detailed_agent_step_output.to_agent_step_output(),
|
output=detailed_agent_step_output.to_agent_step_output(),
|
||||||
)
|
)
|
||||||
return failed_step, detailed_agent_step_output
|
return failed_step, detailed_agent_step_output.get_clean_detailed_output()
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(
|
LOG.exception(
|
||||||
"Unexpected exception in agent_step, marking step as failed",
|
"Unexpected exception in agent_step, marking step as failed",
|
||||||
@@ -665,7 +665,7 @@ class ForgeAgent:
|
|||||||
status=StepStatus.failed,
|
status=StepStatus.failed,
|
||||||
output=detailed_agent_step_output.to_agent_step_output(),
|
output=detailed_agent_step_output.to_agent_step_output(),
|
||||||
)
|
)
|
||||||
return failed_step, detailed_agent_step_output
|
return failed_step, detailed_agent_step_output.get_clean_detailed_output()
|
||||||
|
|
||||||
async def record_artifacts_after_action(self, task: Task, step: Step, browser_state: BrowserState) -> None:
|
async def record_artifacts_after_action(self, task: Task, step: Step, browser_state: BrowserState) -> None:
|
||||||
if not browser_state.page:
|
if not browser_state.page:
|
||||||
|
|||||||
@@ -60,9 +60,23 @@ class DetailedAgentStepOutput(BaseModel):
|
|||||||
errors.extend(action.errors)
|
errors.extend(action.errors)
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
def to_agent_step_output(self) -> AgentStepOutput:
|
def get_clean_detailed_output(self) -> DetailedAgentStepOutput:
|
||||||
return AgentStepOutput(
|
return DetailedAgentStepOutput(
|
||||||
action_results=self.action_results if self.action_results else [],
|
scraped_page=self.scraped_page,
|
||||||
actions_and_results=(self.actions_and_results if self.actions_and_results else []),
|
extract_action_prompt=self.extract_action_prompt,
|
||||||
errors=self.extract_errors(),
|
llm_response=self.llm_response,
|
||||||
|
actions=self.actions,
|
||||||
|
action_results=self.action_results,
|
||||||
|
actions_and_results=None
|
||||||
|
if self.actions_and_results is None
|
||||||
|
else [(action, result) for action, result in self.actions_and_results if result],
|
||||||
|
)
|
||||||
|
|
||||||
|
def to_agent_step_output(self) -> AgentStepOutput:
|
||||||
|
clean_output = self.get_clean_detailed_output()
|
||||||
|
|
||||||
|
return AgentStepOutput(
|
||||||
|
action_results=clean_output.action_results if clean_output.action_results else [],
|
||||||
|
actions_and_results=(clean_output.actions_and_results if clean_output.actions_and_results else []),
|
||||||
|
errors=clean_output.extract_errors(),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user