File size: 993 Bytes
a15535e | 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 | """Pydantic observation model for ForgeEnv."""
from __future__ import annotations
from typing import Any, Optional
from pydantic import Field
from openenv.core import Observation
class ForgeObservation(Observation):
"""What the agent (or the trainer's rollout function) sees at each step.
Inherits `done`, `reward`, `metadata` from the OpenEnv `Observation` base.
"""
current_phase: str = Field(
..., description="One of 'drift_gen', 'repair', 'verify', 'done'"
)
task_id: str = ""
task_description: str = ""
target_category: str = ""
script_content: str = Field(default="", description="Current state of the script")
error_trace: Optional[str] = None
library_versions: dict[str, str] = Field(default_factory=dict)
reward_breakdown: dict[str, Any] = Field(default_factory=dict)
held_out_breakdown: dict[str, float] = Field(default_factory=dict)
episode_step: int = 0
info: dict[str, Any] = Field(default_factory=dict)
|