from dataclasses import dataclass from typing import Literal @dataclass class TimelineEvent: id: str """ID of the event in format `asr_18`""" timestamp: float """When did the event happen""" duration: float """How long did the event last (zero if it does not make sence)""" payload: str """Payload of the event (text for `asr`, description for `vis`, OCR result for `ocr`)""" custom: dict """Custom data""" links: list[str] """ID of related timeline events, empty list for None""" def get_ai_dict(self) -> dict: """Returns dict that is sanitized for AI.""" d = { "id": self.id, "timestamp": self.timestamp, "payload": self.payload } if self.duration: d["duration"] = self.duration if self.links: d["links"] = self.links return d @dataclass class AnalysisWindow: before_readonly: list[TimelineEvent] """Timeline events for context (before current window)""" modifiable: list[TimelineEvent] """Timeline events that are to be analyzed""" after_readonly: list[TimelineEvent] """Timeline events for context (after current window)""" @dataclass class AgentMessage: content: str """Content of the message""" role: Literal["system", "assistant", "user"] """Who sent the message""" @dataclass class TimelineProcessingResult: events: list[TimelineEvent] """List of events""" desired_events: list[TimelineEvent] """List of events desired for existance"""