File size: 1,420 Bytes
fca155a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from abc import ABC, abstractmethod
from typing import List, Dict, Optional, Any
from pathlib import Path

class PerceptionEngine(ABC):
    """Abstract Base Class for the Visual Perception System."""
    
    @abstractmethod
    def load_model(self, model_path: Path) -> None:
        pass

    @abstractmethod
    def analyze_frame(self, frame_path: str, prompt: str) -> str:
        pass
    
    @abstractmethod
    def analyze_video_segment(self, video_path: Path, start_time: float, end_time: float, prompt: str) -> str:
        pass

    @abstractmethod
    def chat(self, messages: List[Dict[str, str]]) -> str:
        """General purpose chat completion (for the Agent brain)."""
        pass

    @abstractmethod
    def generate_text(self, prompt: str, stop: Optional[List[str]] = None) -> str:
        """Raw text completion for advanced prompting."""
        pass

class MemoryManager(ABC):
    """Abstract Base Class for the Knowledge Graph."""
    
    @abstractmethod
    def initialize_storage(self, video_id: str) -> None:
        pass
        
    @abstractmethod
    def commit_event(self, video_id: str, timestamp: str, description: str, metadata: Dict[str, Any]) -> None:
        pass
        
    @abstractmethod
    def query_knowledge(self, video_id: str, query: str) -> List[Dict[str, Any]]:
        pass
        
    @abstractmethod
    def get_summary(self, video_id: str) -> str:
        pass