File size: 1,919 Bytes
8555ea6
 
 
 
 
 
 
0446283
8555ea6
0446283
 
8555ea6
 
 
 
0446283
8555ea6
 
 
0446283
 
 
 
 
 
 
 
 
 
 
 
 
 
8555ea6
 
 
0446283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
48
49
50
51
52
53
54
55
56
57
58
59
# 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 FitScript Environment.

FitScript simulates a real-world AI fitness prescription task:
generating, evaluating, and refining personalized workout plans.
"""

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


class FitscriptAction(Action):
    """Action for the FitScript environment --- fitness plan generation/modification."""

    action_type: str = Field(
        ...,
        description="One of: 'generate_plan' | 'modify_plan' | 'explain_exercise'"
    )
    plan: str = Field(
        default="",
        description="JSON string of structured workout plan (exercises, sets, reps, rest)"
    )
    reasoning: Optional[str] = Field(
        default=None,
        description="Agent justification for the plan choices"
    )


class FitscriptObservation(Observation):
    """Observation from the FitScript environment --- client profile and plan feedback."""

    client_profile: Dict[str, Any] = Field(
        default_factory=dict,
        description="Client info: age, fitness_level, goal, equipment, injuries, days_per_week"
    )
    feedback: str = Field(
        default="",
        description="Environment feedback on the last submitted plan"
    )
    score_breakdown: Dict[str, float] = Field(
        default_factory=dict,
        description="Partial scores per criterion (safety, completeness, progression)"
    )
    task_id: str = Field(
        default="",
        description="Current task identifier"
    )
    step_count: int = Field(
        default=0,
        description="Current step within the episode"
    )
    # done and reward are inherited from the Observation base class