Skip to content

Commit 6c19533

Browse files
authored
Merge pull request #208 from hud-evals/g/fix-computer-overlap
Drop already existing "computer" if the selected computer tool is renamed
2 parents 63906d2 + 37a9905 commit 6c19533

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

hud/agents/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ async def run_task(self, task: Task, max_steps: int = 10) -> Trace:
290290
self.console.progress_log(f"Setting up tool phase: {task.setup_tool}")
291291
results = await self.call_tools(task.setup_tool)
292292
if any(result.isError for result in results):
293+
for result in results:
294+
if result.isError:
295+
self.console.error_log(f"Error in setup tool: {result}")
296+
293297
return Trace(
294298
reward=0.0,
295299
done=True,

hud/agents/claude.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def _convert_tools_for_claude(self) -> None:
267267
if selected_computer_tool:
268268
break
269269

270-
def to_api_tool(tool: types.Tool) -> BetaToolUnionParam:
270+
def to_api_tool(tool: types.Tool) -> BetaToolUnionParam | None:
271271
if tool.name == "str_replace_based_edit_tool":
272272
return BetaToolTextEditor20250728Param(
273273
type="text_editor_20250728",
@@ -278,14 +278,21 @@ def to_api_tool(tool: types.Tool) -> BetaToolUnionParam:
278278
type="bash_20250124",
279279
name="bash",
280280
)
281-
if selected_computer_tool and tool.name == selected_computer_tool.name:
282-
return BetaToolComputerUse20250124Param(
283-
type="computer_20250124",
284-
name="computer",
285-
display_number=1,
286-
display_width_px=computer_settings.ANTHROPIC_COMPUTER_WIDTH,
287-
display_height_px=computer_settings.ANTHROPIC_COMPUTER_HEIGHT,
288-
)
281+
if selected_computer_tool is not None:
282+
if tool.name == selected_computer_tool.name:
283+
return BetaToolComputerUse20250124Param(
284+
type="computer_20250124",
285+
name="computer",
286+
display_number=1,
287+
display_width_px=computer_settings.ANTHROPIC_COMPUTER_WIDTH,
288+
display_height_px=computer_settings.ANTHROPIC_COMPUTER_HEIGHT,
289+
)
290+
elif tool.name == "computer":
291+
logger.warning(
292+
"Renamed tool %s to 'computer', dropping original 'computer' tool",
293+
selected_computer_tool.name,
294+
)
295+
return None
289296

290297
if tool.description is None or tool.inputSchema is None:
291298
raise ValueError(
@@ -295,7 +302,7 @@ def to_api_tool(tool: types.Tool) -> BetaToolUnionParam:
295302
2. Using pydantic Field() annotations on function parameters for the schema
296303
""")
297304
)
298-
"""Convert a tool to the API format"""
305+
299306
return BetaToolParam(
300307
name=tool.name,
301308
description=tool.description,
@@ -307,6 +314,8 @@ def to_api_tool(tool: types.Tool) -> BetaToolUnionParam:
307314
self.claude_tools = []
308315
for tool in available_tools:
309316
claude_tool = to_api_tool(tool)
317+
if claude_tool is None:
318+
continue
310319
if claude_tool["name"] == "computer":
311320
self.has_computer_tool = True
312321
self.tool_mapping[claude_tool["name"]] = tool.name

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040
"numpy>=1.24.0",
4141
"pillow>=11.1.0",
4242
# AI providers
43-
"anthropic",
43+
"anthropic>=0.70",
4444
"openai",
4545
"google-genai",
4646
"tornado>=6.5.2",

0 commit comments

Comments
 (0)