error.py 608 B

1234567891011121314151617181920212223
  1. from dataclasses import dataclass
  2. from openhands.core.schema import ObservationType
  3. from openhands.events.observation.observation import Observation
  4. @dataclass
  5. class ErrorObservation(Observation):
  6. """This data class represents an error encountered by the agent.
  7. This is the type of error that LLM can recover from.
  8. E.g., Linter error after editing a file.
  9. """
  10. observation: str = ObservationType.ERROR
  11. error_id: str = ''
  12. @property
  13. def message(self) -> str:
  14. return self.content
  15. def __str__(self) -> str:
  16. return f'**ErrorObservation**\n{self.content}'