File size: 824 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
from src.interfaces.base import PerceptionEngine, MemoryManager
from src.core.graph import create_agent_graph

class VideoAgent:
    def __init__(self, perception: PerceptionEngine, memory: MemoryManager):
        self.graph = create_agent_graph(perception, memory)
        self.context = {} # Scout/Index injection

    def ask(self, question: str, video_id: str) -> str:
        """
        Runs the Linear Pipeline.
        """
        initial_state = {
            "query": question,
            "video_id": video_id,
            "plan": "",
            "search_term": "",
            "timestamps": [],
            "observations": [],
            "final_answer": "",
            "context": self.context
        }
        
        final_state = self.graph.invoke(initial_state)
        return final_state["final_answer"]