Spaces:
Configuration error

File size: 610 Bytes
2d63f96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import abc

from pydantic import BaseModel

from openhands.events import Event


class CriticResult(BaseModel):
    """
    A critic result is a score and a message.
    """

    score: float
    message: str

    @property
    def success(self) -> bool:
        """
        Whether the agent is successful.
        """
        return self.score >= 0.5


class BaseCritic(abc.ABC):
    """
    A critic is a function that takes in a list of events and returns a score about the quality of those events.
    """

    @abc.abstractmethod
    def evaluate(self, events: list[Event]) -> CriticResult:
        pass