File size: 1,531 Bytes
fdce872
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Data models for the SWEbench-IN Environment.

Defines the Action and Observation types used by the OpenEnv server
and client for the SWEbench-IN RL environment.
"""

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


class SWEbenchINAction(Action):
    """Action for the SWEbench-IN environment."""

    type: str = Field(
        ...,
        description="Action type: run_command, read_file, write_file, run_tests, "
                    "check_server, reply_slack, reply_email, reply_hr, close_case"
    )
    args: str = Field(
        default="",
        description="Action arguments (command, path, content, etc.)"
    )


class SWEbenchINObservation(Observation):
    """Observation from the SWEbench-IN environment."""

    text: str = Field(default="", description="Observation text from the environment")
    reward: Optional[float] = Field(default=None, description="Step reward")
    done: bool = Field(default=False, description="Whether the episode is done")
    step_count: int = Field(default=0, description="Current step count")
    max_steps: int = Field(default=15, description="Maximum steps for this task")
    tests_passing_ratio: float = Field(default=0.0, description="Ratio of tests passing")
    server_running: bool = Field(default=False, description="Whether the server is running")
    reward_breakdown: Dict[str, float] = Field(
        default_factory=dict,
        description="Breakdown of reward components"
    )