Skip to content

Commit

Permalink
bug fix on unhandled exception of results not populated when LLM call…
Browse files Browse the repository at this point in the history
… fails
  • Loading branch information
shriyanshagnihotri committed Dec 10, 2024
1 parent 4aa7184 commit 6b4c449
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion testzeus_hercules/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def sequential_process() -> None:
asyncio.run(runner.start())

runner_result = {}
cost_metrics = runner.result.cost or {}
cost_metrics = {}
if runner.result and runner.result.cost:
cost_metrics = runner.result.cost
execution_time = runner.execution_time
if runner.result and runner.result.chat_history:
s_rr = runner.result.chat_history[-1]["content"]
Expand Down
3 changes: 2 additions & 1 deletion testzeus_hercules/core/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ async def process_command(self, command: str) -> tuple[Any, float]:
await self.browser_manager.update_processing_state("done") # type: ignore
end_time = time.time()
elapsed_time = round(end_time - start_time, 2)
logger.info(f'Command "{command}" took: {elapsed_time} seconds. and total cost metric is {result.cost}') # type: ignore

await self.save_planner_chat_messages()
if result is not None:
logger.info(f'Command "{command}" took: {elapsed_time} seconds. and total cost metric is {result.cost}') # type: ignore
chat_history = result.chat_history # type: ignore
last_message = chat_history[-1] if chat_history else None # type: ignore
if (
Expand Down

0 comments on commit 6b4c449

Please sign in to comment.