Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fixed issue 344

Jagjeevan Kashid123f95ae255d
diff --git a/libs/python/agent/agent/computers/base.py b/libs/python/agent/agent/computers/base.py
index 7fbcb0f76f..358fbbf426 100644
--- a/libs/python/agent/agent/computers/base.py
+++ b/libs/python/agent/agent/computers/base.py
@@ -19,8 +19,12 @@ class AsyncComputerHandler(Protocol):
"""Get screen dimensions as (width, height)."""
...
- async def screenshot(self) -> str:
- """Take a screenshot and return as base64 string."""
+ async def screenshot(self, text: Optional[str] = None) -> str:
+ """Take a screenshot and return as base64 string.
+
+ Args:
+ text: Optional descriptive text (for compatibility with GPT-4o models, ignored)
+ """
...
async def click(self, x: int, y: int, button: str = "left") -> None:
diff --git a/libs/python/agent/agent/computers/cua.py b/libs/python/agent/agent/computers/cua.py
index f935be5b4f..4033795019 100644
--- a/libs/python/agent/agent/computers/cua.py
+++ b/libs/python/agent/agent/computers/cua.py
@@ -33,8 +33,12 @@ class cuaComputerHandler(AsyncComputerHandler):
screen_size = await self.interface.get_screen_size()
return screen_size["width"], screen_size["height"]
- async def screenshot(self) -> str:
- """Take a screenshot and return as base64 string."""
+ async def screenshot(self, text: Optional[str] = None) -> str:
+ """Take a screenshot and return as base64 string.
+
+ Args:
+ text: Optional descriptive text (for compatibility with GPT-4o models, ignored)
+ """
assert self.interface is not None
screenshot_bytes = await self.interface.screenshot()
return base64.b64encode(screenshot_bytes).decode('utf-8')
diff --git a/libs/python/agent/agent/computers/custom.py b/libs/python/agent/agent/computers/custom.py
index b5f801b69b..5ab7d535f2 100644
--- a/libs/python/agent/agent/computers/custom.py
+++ b/libs/python/agent/agent/computers/custom.py
@@ -120,8 +120,12 @@ class CustomComputerHandler(AsyncComputerHandler):
return self._last_screenshot_size
- async def screenshot(self) -> str:
- """Take a screenshot and return as base64 string."""
+ async def screenshot(self, text: Optional[str] = None) -> str:
+ """Take a screenshot and return as base64 string.
+
+ Args:
+ text: Optional descriptive text (for compatibility with GPT-4o models, ignored)
+ """
result = await self._call_function(self.functions['screenshot'])
b64_str = self._to_b64_str(result) # type: ignore