Update examples, wherever possible, to use LLMContext and associated machinery instead of OpenAILLMContext and associated machinery.
With all these examples updated, we no longer need dedicated examples illustrating `LLMContext`, so they're removed. Here’s where we *don’t* yet use `LLMContext` and associated machinery: - Realtime services: OpenAI Realtime, Gemini Live, and AWS Nova Sonic (support coming soon) - `GoogleLLMOpenAIBetaService` (it’s deprecated, so we didn’t bother adding support) - `LLMLogObserver` (support coming soon) - `GatedOpenAILLMContextAggregator` (support coming soon) - `LangchainProcessor` (support coming soon) - `Mem0MemoryService` (support coming soon) - Examples that use LLM-specific tools definitions as opposed to `ToolsSchema` (these will be updated soon) - Examples that rely `GoogleLLMContext.upgrade_to_google` (TBD what to do with these) Examples that use `LLMLogObserver`: - 30- Examples that use `GatedOpenAILLMContextAggregator`: - 22- Examples that use `LangchainProcessor`: - 07b- Examples that use `Mem0MemoryService`: - 37- Examples that need updating to use `ToolsSchema`: - 15- - 15a- - 20a- - 20c- - 20d- - 22b- - 22c- - 33- - 36- Examples that use `GoogleLLMContext.upgrade_to_google`: - 22d- - 25-
This commit is contained in:
@@ -16,6 +16,7 @@ from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.audio.vad.vad_analyzer import VADParams
|
||||
from pipecat.frames.frames import (
|
||||
Frame,
|
||||
LLMContextFrame,
|
||||
LLMFullResponseEndFrame,
|
||||
OutputAudioRawFrame,
|
||||
TTSSpeakFrame,
|
||||
@@ -23,10 +24,8 @@ from pipecat.frames.frames import (
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineTask
|
||||
from pipecat.processors.aggregators.openai_llm_context import (
|
||||
OpenAILLMContext,
|
||||
OpenAILLMContextFrame,
|
||||
)
|
||||
from pipecat.processors.aggregators.llm_context import LLMContext
|
||||
from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair
|
||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||
from pipecat.processors.logger import FrameLogger
|
||||
from pipecat.runner.types import RunnerArguments
|
||||
@@ -74,7 +73,7 @@ class InboundSoundEffectWrapper(FrameProcessor):
|
||||
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||
await super().process_frame(frame, direction)
|
||||
|
||||
if isinstance(frame, OpenAILLMContextFrame):
|
||||
if isinstance(frame, LLMContextFrame):
|
||||
await self.push_frame(sounds["ding2.wav"])
|
||||
# In case anything else downstream needs it
|
||||
await self.push_frame(frame, direction)
|
||||
@@ -126,8 +125,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
},
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
context = LLMContext(messages)
|
||||
context_aggregator = LLMContextAggregatorPair(context)
|
||||
out_sound = OutboundSoundEffectWrapper()
|
||||
in_sound = InboundSoundEffectWrapper()
|
||||
fl = FrameLogger("LLM Out")
|
||||
|
||||
Reference in New Issue
Block a user