-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
46 lines (37 loc) · 1.13 KB
/
Copy pathmodels.py
File metadata and controls
46 lines (37 loc) · 1.13 KB
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
from pydantic import BaseModel, ConfigDict
from typing import List, Literal, Optional, Tuple
# --- Custom observation and action logic ---
class Observation(BaseModel):
model_config = ConfigDict(strict=True)
grid_size: Tuple[int, int]
robot_position: Tuple[int, int]
garbage_positions: List[Tuple[int, int]]
obstacle_positions: List[Tuple[int, int]]
battery_level: int
inventory_count: int
message: str # Textual context for LLM
class Action(BaseModel):
model_config = ConfigDict(strict=True)
command: Literal["UP", "DOWN", "LEFT", "RIGHT", "COLLECT"]
# --- OpenEnv Standard Spec Models ---
class State(BaseModel):
model_config = ConfigDict(strict=True)
task_id: Optional[str]
total_reward: float
steps_taken: int
done: bool
class ResetInput(BaseModel):
task_id: str = "task_easy"
class ResetOutput(BaseModel):
observation: Observation
class StepOutput(BaseModel):
observation: Observation
reward: float
done: bool
info: dict = {}
class Task(BaseModel):
id: str
name: str
description: str
difficulty: str
reward_range: List[float]