mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
29 lines
684 B
Python
29 lines
684 B
Python
from dataclasses import dataclass
|
|
|
|
from openhands.core.schema import ObservationType
|
|
from openhands.events.observation.observation import Observation
|
|
|
|
|
|
@dataclass
|
|
class FileReadObservation(Observation):
|
|
"""This data class represents the content of a file."""
|
|
|
|
path: str
|
|
observation: str = ObservationType.READ
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f'I read the file {self.path}.'
|
|
|
|
|
|
@dataclass
|
|
class FileWriteObservation(Observation):
|
|
"""This data class represents a file write operation"""
|
|
|
|
path: str
|
|
observation: str = ObservationType.WRITE
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f'I wrote to the file {self.path}.'
|