File size: 1,522 Bytes
678aaed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53692f5
9a6cc06
53692f5
9a6cc06
678aaed
 
 
 
 
 
 
192c450
9a6cc06
678aaed
 
 
 
 
9a6cc06
 
678aaed
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
# 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 Skill Forge Environment.

The skill_forge environment is a simple test environment that echoes back messages.
"""

from pydantic import Field, BaseModel
from typing import Literal, Optional, Dict, List

from openenv.core.env_server.types import Action, Observation

class SkillForgeAction(Action):
    """Action for the Skill Forge environment"""
    action_type: Literal["create_skill", "use_skill", "raw_code"]
    content: str = Field(description="The content of the action. For create_skill, it is the template. For use_skill, it is the skill id. For raw_code, it is the code.")
    skill_name: str = "" # only for create_skill
    reasoning: str = ""
    params: dict = Field(default_factory=dict, description="Template slot values for use_skill")


class SkillForgeObservation(Observation):
    """Observation from the Skill Forge environment."""
    task_id: str
    task_description: str
    snapshot_data: str  #df.head(5).to_string()
    skill_library: dict
    context: str
    result_correct: bool
    result_output: str
    expected_output: str
    step_count: int
    total_tokens: int
    reward: Optional[float] = Field(default=None, description="Reward signal from the last action")
    done: bool = Field(default=False, description="Whether the episode has terminated")