File size: 996 Bytes
1f89afe
bc52096
 
 
1f89afe
 
bc52096
 
1f89afe
9ae534f
bc52096
 
 
 
 
1f89afe
bc52096
 
 
 
 
 
 
 
 
 
 
1f89afe
bc52096
 
 
 
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
"""OpenEnv types for the Origami RL environment."""

from typing import Any, Optional

from openenv.core import Action, Observation, State
from pydantic import Field


class OrigamiAction(Action):
    """LLM submits a FOLD crease pattern as its action."""
    fold_data: dict[str, Any] = Field(
        ..., description="FOLD-format crease pattern JSON"
    )


class OrigamiObservation(Observation):
    """Result of simulating the LLM's crease pattern."""
    task: dict[str, Any] = Field(default_factory=dict)
    fold_data: dict[str, Any] = Field(default_factory=dict)
    final_positions: list[list[float]] = Field(default_factory=list)
    target_positions: list[list[float]] = Field(default_factory=list)
    shape_similarity: float = 0.0
    max_strain: float = 0.0
    is_stable: bool = True
    error: Optional[str] = None


class OrigamiState(State):
    """Internal state for an origami episode."""
    task_name: str = ""
    shape_similarity: float = 0.0
    is_stable: bool = True