Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/askui/tools/anthropic/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass, fields, replace
from typing import Any
from typing import Any, Optional

from anthropic.types.beta import BetaToolUnionParam

Expand Down Expand Up @@ -74,9 +74,10 @@ class ToolError(Exception):

Args:
message (str): The error message.
result (ToolResult): The ToolResult that caused the error.
result (ToolResult, optional): The ToolResult that caused the error.
"""

def __init__(self, message: str, result: ToolResult):
def __init__(self, message: str, result: Optional[ToolResult] = None):
self.message = message
self.result = result
super().__init__(self.message)
4 changes: 2 additions & 2 deletions src/askui/tools/anthropic/computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def __call__(
if coordinate is not None:
raise ToolError(f"coordinate is not accepted for {action}")
if not isinstance(text, str):
raise ToolError(output=f"{text} must be a string")
raise ToolError(f"{text} must be a string")

if action == "key":
if text in KEYSYM_MAP.keys():
Expand Down Expand Up @@ -312,7 +312,7 @@ def __call__(
return self.screenshot()
if action == "cursor_position":
# TODO: Implement in the future
return ToolError("cursor_position is not implemented by this agent")
raise ToolError("cursor_position is not implemented by this agent")
if action == "left_click":
self.controller_client.click("left")
return ToolResult()
Expand Down