files.py 664 B

1234567891011121314151617181920212223242526272829303132
  1. from dataclasses import dataclass
  2. from .base import Observation
  3. from opendevin.schema import ObservationType
  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}.'