File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
src/askui/tools/anthropic Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 11from abc import ABCMeta , abstractmethod
22from dataclasses import dataclass , fields , replace
3- from typing import Any
3+ from typing import Any , Optional
44
55from anthropic .types .beta import BetaToolUnionParam
66
@@ -74,9 +74,10 @@ class ToolError(Exception):
7474
7575 Args:
7676 message (str): The error message.
77- result (ToolResult): The ToolResult that caused the error.
77+ result (ToolResult, optional ): The ToolResult that caused the error.
7878 """
7979
80- def __init__ (self , message : str , result : ToolResult ):
80+ def __init__ (self , message : str , result : Optional [ ToolResult ] = None ):
8181 self .message = message
8282 self .result = result
83+ super ().__init__ (self .message )
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ def __call__(
278278 if coordinate is not None :
279279 raise ToolError (f"coordinate is not accepted for { action } " )
280280 if not isinstance (text , str ):
281- raise ToolError (output = f"{ text } must be a string" )
281+ raise ToolError (f"{ text } must be a string" )
282282
283283 if action == "key" :
284284 if text in KEYSYM_MAP .keys ():
@@ -312,7 +312,7 @@ def __call__(
312312 return self .screenshot ()
313313 if action == "cursor_position" :
314314 # TODO: Implement in the future
315- return ToolError ("cursor_position is not implemented by this agent" )
315+ raise ToolError ("cursor_position is not implemented by this agent" )
316316 if action == "left_click" :
317317 self .controller_client .click ("left" )
318318 return ToolResult ()
You can’t perform that action at this time.
0 commit comments