Spaces:
Running
Running
File size: 1,349 Bytes
f7185ba 0a7b128 f7185ba 0a7b128 f7185ba 0a7b128 f7185ba aa3ea4b f7185ba 0a7b128 f7185ba 409fe68 f7185ba 409fe68 f7185ba | 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 | """
Pydantic models for the Libratio Fleet OpenEnv API.
Typed Observation, Action, and Response schemas for OpenEnv spec compliance.
"""
from typing import Any, Dict, List, Literal, Optional
from pydantic import BaseModel, Field
PrecisionLevel = Literal["FP32", "BF16", "FP16", "FP8", "INT8"]
class RewardPayload(BaseModel):
score: float = Field(..., gt=0.0, lt=1.0, description="Normalized score strictly in (0, 1)")
feedback: str = Field(..., description="Human-readable grading explanation")
class StepResponse(BaseModel):
observation: Optional[Dict[str, Any]] = None
reward: RewardPayload
done: bool
info: Dict[str, Any] = {}
class ResetRequest(BaseModel):
task_id: str = "fleet_precision"
scenario_id: Optional[str] = None
session_id: Optional[str] = None
class StepRequest(BaseModel):
action: Optional[Dict[str, Any]] = None
session_id: Optional[str] = None
class ResetResponse(BaseModel):
observation: Dict[str, Any]
class StateResponse(BaseModel):
task_id: Optional[str] = None
current_task: Optional[str] = None
current_scenario_id: Optional[str] = None
step_number: int = 0
is_done: bool = True
history: List[Dict[str, Any]] = []
class TaskDefinition(BaseModel):
id: str
task_id: str
description: str
difficulty: str
max_steps: int
|