examples: use OpenAILLMContext in all the examples

This commit is contained in:
Aleix Conchillo Flaqué
2024-10-18 23:23:36 -07:00
parent 4f66e5d55f
commit be4bdabdf4
33 changed files with 166 additions and 243 deletions

View File

@@ -15,10 +15,6 @@ from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineParams, PipelineTask
from pipecat.processors.aggregators.llm_response import (
LLMAssistantResponseAggregator,
LLMUserResponseAggregator,
)
from pipecat.frames.frames import (
OutputImageRawFrame,
SpriteFrame,
@@ -27,6 +23,7 @@ from pipecat.frames.frames import (
TTSAudioRawFrame,
TTSStoppedFrame,
)
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
from pipecat.services.elevenlabs import ElevenLabsTTSService
from pipecat.services.openai import OpenAILLMService
@@ -143,20 +140,20 @@ async def main():
},
]
user_response = LLMUserResponseAggregator()
assistant_response = LLMAssistantResponseAggregator()
context = OpenAILLMContext(messages)
context_aggregator = llm.create_context_aggregator(context)
ta = TalkingAnimation()
pipeline = Pipeline(
[
transport.input(),
user_response,
context_aggregator.user(),
llm,
tts,
ta,
transport.output(),
assistant_response,
context_aggregator.assistant(),
]
)