Skip to content
Open
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
8 changes: 6 additions & 2 deletions libs/python/agent/agent/computers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ async def get_dimensions(self) -> tuple[int, int]:
"""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:
Expand Down
8 changes: 6 additions & 2 deletions libs/python/agent/agent/computers/cua.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ async def get_dimensions(self) -> tuple[int, int]:
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')
Expand Down
8 changes: 6 additions & 2 deletions libs/python/agent/agent/computers/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ async def get_dimensions(self) -> tuple[int, int]:

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

Expand Down