Skip to content

Commit 6b4c449

Browse files
author
Shriyansh Agnihotri
committed
bug fix on unhandled exception of results not populated when LLM call fails
1 parent 4aa7184 commit 6b4c449

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

testzeus_hercules/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def sequential_process() -> None:
7474
asyncio.run(runner.start())
7575

7676
runner_result = {}
77-
cost_metrics = runner.result.cost or {}
77+
cost_metrics = {}
78+
if runner.result and runner.result.cost:
79+
cost_metrics = runner.result.cost
7880
execution_time = runner.execution_time
7981
if runner.result and runner.result.chat_history:
8082
s_rr = runner.result.chat_history[-1]["content"]

testzeus_hercules/core/runner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ async def process_command(self, command: str) -> tuple[Any, float]:
102102
await self.browser_manager.update_processing_state("done") # type: ignore
103103
end_time = time.time()
104104
elapsed_time = round(end_time - start_time, 2)
105-
logger.info(f'Command "{command}" took: {elapsed_time} seconds. and total cost metric is {result.cost}') # type: ignore
105+
106106
await self.save_planner_chat_messages()
107107
if result is not None:
108+
logger.info(f'Command "{command}" took: {elapsed_time} seconds. and total cost metric is {result.cost}') # type: ignore
108109
chat_history = result.chat_history # type: ignore
109110
last_message = chat_history[-1] if chat_history else None # type: ignore
110111
if (

0 commit comments

Comments
 (0)