File size: 1,221 Bytes
7952f32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
"""Pydantic wire models for the multi-turn repo-editing environment."""

from __future__ import annotations

from typing import Any, Optional

from pydantic import BaseModel, ConfigDict, Field

_cfg = ConfigDict(extra="ignore")


class RepoEditObservation(BaseModel):
    """What the env returns after reset() or step().

    Contains the current graph overview + the result of the last action.
    The agent should read action_result carefully before deciding the next step.
    """

    model_config = _cfg

    episode_id: Optional[str] = None
    task_id: Optional[str] = None
    turn: int = 0
    max_turns: int = 15

    graph_overview: str = ""       # compact text view of the entire repo KG
    task_description: str = ""     # what the agent needs to accomplish
    action_result: str = ""        # feedback from the last action

    turn_reward: float = 0.0
    total_reward: float = 0.0
    done: bool = False

    info: dict[str, Any] = Field(default_factory=dict)


class RepoEditState(BaseModel):
    """Episode-level state snapshot."""

    model_config = _cfg

    episode_id: Optional[str] = None
    task_id: Optional[str] = None
    turn: int = 0
    done: bool = False
    total_reward: float = 0.0