Spaces:
Configuration error
Configuration error
Download openhands/events/action/browse.py from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/events/action/browse.py
- Command line
-
hf download hf://spaces/flyingdarkdev/README/openhands/events/action/browse.py
-
curl -L -o browse.py https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/events/action/browse.py
1.34 kB
| from dataclasses import dataclass | |
| from typing import ClassVar | |
| from openhands.core.schema import ActionType | |
| from openhands.events.action.action import Action, ActionSecurityRisk | |
| class BrowseURLAction(Action): | |
| url: str | |
| thought: str = '' | |
| action: str = ActionType.BROWSE | |
| runnable: ClassVar[bool] = True | |
| security_risk: ActionSecurityRisk | None = None | |
| def message(self) -> str: | |
| return f'I am browsing the URL: {self.url}' | |
| def __str__(self) -> str: | |
| ret = '**BrowseURLAction**\n' | |
| if self.thought: | |
| ret += f'THOUGHT: {self.thought}\n' | |
| ret += f'URL: {self.url}' | |
| return ret | |
| class BrowseInteractiveAction(Action): | |
| browser_actions: str | |
| thought: str = '' | |
| browsergym_send_msg_to_user: str = '' | |
| action: str = ActionType.BROWSE_INTERACTIVE | |
| runnable: ClassVar[bool] = True | |
| security_risk: ActionSecurityRisk | None = None | |
| def message(self) -> str: | |
| return ( | |
| f'I am interacting with the browser:\n' f'```\n{self.browser_actions}\n```' | |
| ) | |
| def __str__(self) -> str: | |
| ret = '**BrowseInteractiveAction**\n' | |
| if self.thought: | |
| ret += f'THOUGHT: {self.thought}\n' | |
| ret += f'BROWSER_ACTIONS: {self.browser_actions}' | |
| return ret | |