File size: 884 Bytes
8d96200
 
 
 
7e9c2fa
8d96200
80454a1
8d96200
 
7e9c2fa
8d96200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80454a1
 
 
 
 
cdd4363
80454a1
cdd4363
80454a1
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
33
34
35
36
37
"""Pydantic models for the PR Review OpenEnv."""

from __future__ import annotations

from typing import Literal, Optional

from pydantic import BaseModel, field_validator

class PRReviewAction(BaseModel):
    action_type: Literal["comment", "approve", "request_changes"]
    file: Optional[str] = None
    line: Optional[int] = None
    body: str = ""

class PRReviewObservation(BaseModel):
    diff: str
    pr_description: str
    pr_title: str
    file_tree: list[str] = []
    comments_so_far: list[dict] = []
    step_count: int = 0
    done: bool = False
    scenario_id: str = ""

class PRReviewReward(BaseModel):
    value: float
    breakdown: dict = {}

    @field_validator("value")
    @classmethod
    def reward_must_be_strictly_between(cls, v: float) -> float:
        if v <= 0.0:
            return 0.02
        if v >= 1.0:
            return 0.98
        return v