files.py 657 B

1234567891011121314151617181920212223242526272829
  1. from dataclasses import dataclass
  2. from opendevin.core.schema import ObservationType
  3. from .observation import Observation
  4. @dataclass
  5. class FileReadObservation(Observation):
  6. """This data class represents the content of a file."""
  7. path: str
  8. observation: str = ObservationType.READ
  9. @property
  10. def message(self) -> str:
  11. return f'I read the file {self.path}.'
  12. @dataclass
  13. class FileWriteObservation(Observation):
  14. """This data class represents a file write operation"""
  15. path: str
  16. observation: str = ObservationType.WRITE
  17. @property
  18. def message(self) -> str:
  19. return f'I wrote to the file {self.path}.'