browse.py 518 B

123456789101112131415161718192021
  1. import requests
  2. from dataclasses import dataclass
  3. from opendevin.observation import BrowserOutputObservation
  4. from .base import ExecutableAction
  5. @dataclass
  6. class BrowseURLAction(ExecutableAction):
  7. url: str
  8. def run(self, *args, **kwargs) -> BrowserOutputObservation:
  9. response = requests.get(self.url)
  10. return BrowserOutputObservation(
  11. content=response.text,
  12. url=self.url
  13. )
  14. @property
  15. def message(self) -> str:
  16. return f"Browsing URL: {self.url}"