File size: 1,325 Bytes
03a907a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

"""

Data models for the Code Fixer Environment.

"""

from typing import Optional
from openenv.core.env_server.types import Action, Observation
from pydantic import Field


class CodeFixerAction(Action):
    """Action for the Code Fixer environment."""
    type: str = Field(..., description="Action type (apply_patch, run_tests, get_logs)")
    payload: Optional[str] = Field(default=None, description="The code patch or test command")


class CodeFixerObservation(Observation):
    """Observation from the Code Fixer environment."""
    code: str = Field(default="", description="The current code")
    logs: Optional[str] = Field(default=None, description="Execution logs")
    test_score: float = Field(default=0.0, description="Test success score (0.0-1.0)")
    total_tests: int = Field(default=1, description="Total number of tests")
    steps: int = Field(default=0, description="Current step count")
    done: bool = Field(default=False, description="Whether the episode is complete")
    reward: Optional[float] = Field(default=None, description="Reward from the latest step")