files.py 677 B

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