Download models.py from Papajams/liarsdice-openenv: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/datasets/Papajams/liarsdice-openenv/resolve/main/models.py
- Command line
-
hf download hf://datasets/Papajams/liarsdice-openenv/models.py
-
curl -L -o models.py https://huggingface.co/datasets/Papajams/liarsdice-openenv/resolve/main/models.py
1.28 kB
| from typing import Any, Literal | |
| from openenv.core.env_server.types import Action, Observation, State | |
| from pydantic import Field, model_validator | |
| class LiarsDiceAction(Action): | |
| action_type: Literal["bid", "call"] = Field( | |
| ..., description="Bid a quantity/face or call the previous bid" | |
| ) | |
| quantity: int | None = Field( | |
| default=None, description="Bid quantity, required for bid" | |
| ) | |
| face: int | None = Field(default=None, description="Bid face, required for bid") | |
| def validate_bid_fields(self): | |
| if self.action_type == "bid" and (self.quantity is None or self.face is None): | |
| raise ValueError("quantity and face are required for bid actions") | |
| return self | |
| class LiarsDiceObservation(Observation): | |
| active_player: int = Field(default=0) | |
| viewer: int = Field(default=0) | |
| private_dice: list[int] = Field(default_factory=list) | |
| bid_history: list[dict[str, Any]] = Field(default_factory=list) | |
| last_bid: dict[str, int] | None = None | |
| legal_actions: list[dict[str, Any]] = Field(default_factory=list) | |
| mode: str = "self_play" | |
| terminal_info: dict[str, Any] | None = None | |
| class LiarsDiceState(State): | |
| active_player: int = 0 | |
| mode: str = "self_play" | |