[WIP] Universal (LLM-agnostic) context machinery to support runtime LLM switching.

- Added universal `LLMContext` and associated context aggregators.
This commit is contained in:
Paul Kompfner
2025-08-12 14:20:56 -04:00
parent 37980b0854
commit ff8d158e18
3 changed files with 1062 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ from pipecat.utils.time import nanoseconds_to_str
from pipecat.utils.utils import obj_count, obj_id
if TYPE_CHECKING:
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.frame_processor import FrameProcessor
@@ -474,6 +475,20 @@ class TranscriptionUpdateFrame(DataFrame):
return f"{self.name}(pts: {pts}, messages: {len(self.messages)})"
@dataclass
class LLMContextFrame(Frame):
"""Frame containing a universal LLM context.
Used as a signal to LLM services to ingest the provided context and
generate a response based on it.
Parameters:
context: The LLM context containing messages, tools, and configuration.
"""
context: "LLMContext"
@dataclass
class LLMMessagesFrame(DataFrame):
"""Frame containing LLM messages for chat completion.