project_charles / agent_state_actor.py
sohojoe's picture
refactor: use more of a MDP style structure
149eeaf
raw
history blame
834 Bytes
from datetime import datetime
import ray
from copy import deepcopy
class AgentState:
def __init__(self):
self.timestamp = datetime.utcnow()
self.input_stt_preview = ''
self.prompts = []
self.video_input = None
@ray.remote
class AgentStateActor:
def __init__(self):
self.begin_step()
def begin_step(self):
self.state = AgentState()
# self.state = deepcopy(self.state)
# self.state.timestamp = datetime.utcnow()
def set_input_stt_preview(self, input_stt_preview):
self.state.input_stt_preview = input_stt_preview
def add_input_stt_prompt(self, prompt):
self.state.prompts.append(prompt)
def add_video_input(self, video_input):
self.state.video_input = video_input
def get_state(self):
return self.state