Spaces:
Sleeping
Sleeping
File size: 1,383 Bytes
41ea373 | 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 | from __future__ import annotations
import uuid
from dataclasses import dataclass, field
from typing import List
from viral_script_engine.environment.actions import ActionType
from viral_script_engine.environment.observations import DebateRound, RewardComponents
@dataclass
class EpisodeState:
episode_id: str
original_script: str
current_script: str
region: str
platform: str
niche: str
step_num: int
max_steps: int
debate_history: List[DebateRound]
episode_start_rewards: RewardComponents
last_reward_components: RewardComponents
difficulty_level: str
action_history: List[ActionType]
@classmethod
def new(
cls,
script: dict,
max_steps: int,
difficulty_level: str,
initial_rewards: RewardComponents,
) -> EpisodeState:
return cls(
episode_id=str(uuid.uuid4()),
original_script=script["script_text"],
current_script=script["script_text"],
region=script["region"],
platform=script["platform"],
niche=script["niche"],
step_num=0,
max_steps=max_steps,
debate_history=[],
episode_start_rewards=initial_rewards,
last_reward_components=initial_rewards,
difficulty_level=difficulty_level,
action_history=[],
)
|