Skip to content

Commit 1833eb4

Browse files
committed
Merge branch 'main' into l/text-2048
2 parents f31f7d6 + 5b5e5de commit 1833eb4

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

hud/mcp/base.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ async def _run_task(self, task: TaskConfig, max_steps: int = 10) -> AgentResult:
377377
and eval_result.structuredContent is not None
378378
):
379379
return AgentResult(
380-
reward=self._find_reward(eval_result.structuredContent),
381-
done=eval_result.structuredContent.get("done", True),
382-
info=eval_result.structuredContent.get("info", {}),
380+
reward=_find_reward(eval_result),
381+
done=True,
382+
content=_find_content(eval_result),
383383
messages=prompt_result.messages,
384384
)
385385
else:
@@ -403,18 +403,6 @@ async def _run_task(self, task: TaskConfig, max_steps: int = 10) -> AgentResult:
403403
except Exception as e:
404404
return AgentResult(reward=0.0, done=True, error=str(e))
405405

406-
def _find_reward(self, result: dict) -> float:
407-
"""Find the reward in the result.
408-
409-
Agent accepts "reward", "grade", "score"
410-
411-
If not found, return 0.0
412-
"""
413-
accept_keys = ["reward", "grade", "score"]
414-
for key in accept_keys:
415-
if isinstance(result, dict) and key in result:
416-
return result[key]
417-
return 0.0
418406

419407
def _format_error_result(self, error_message: str) -> MCPToolResult:
420408
return MCPToolResult(
@@ -553,6 +541,10 @@ async def _run_prompt(self, prompt: str, max_steps: int = 10) -> AgentResult:
553541
"Model response - Tool calls: %s",
554542
[f"{tc.name}: {tc.arguments}" for tc in response.tool_calls],
555543
)
544+
for tool_call in response.tool_calls:
545+
logger.info("Called tool: %s with args %s", tool_call.name, tool_call.arguments)
546+
547+
logger.info("Model response - Done: %s", response.done)
556548

557549
# Check if we should stop
558550
if response.done:
@@ -673,7 +665,6 @@ def _find_reward(result: MCPToolResult) -> float:
673665
return result.structuredContent[key]
674666
return 0.0
675667

676-
677668
def _find_content(result: MCPToolResult) -> str | None:
678669
"""Find the content in the result.
679670

0 commit comments

Comments
 (0)