diff --git a/examples/quickstart/bot.py b/examples/quickstart/bot.py index d890b8b2c..bf75616d0 100644 --- a/examples/quickstart/bot.py +++ b/examples/quickstart/bot.py @@ -44,8 +44,11 @@ from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.llm_context import LLMContext -from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair -from pipecat.processors.frameworks.rtvi import RTVIConfig, RTVIObserver, RTVIProcessor +from pipecat.processors.aggregators.llm_response_universal import ( + LLMContextAggregatorPair, + LLMUserAggregatorParams, +) +from pipecat.processors.frameworks.rtvi import RTVIObserver, RTVIProcessor from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService @@ -53,6 +56,10 @@ from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.openai.llm import OpenAILLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams +from pipecat.turns.user_stop.turn_analyzer_user_turn_stop_strategy import ( + TurnAnalyzerUserTurnStopStrategy, +) +from pipecat.turns.user_turn_strategies import UserTurnStrategies logger.info("✅ All components loaded successfully!") @@ -79,20 +86,27 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): ] context = LLMContext(messages) - context_aggregator = LLMContextAggregatorPair(context) + user_aggregator, assistant_aggregator = LLMContextAggregatorPair( + context, + user_params=LLMUserAggregatorParams( + user_turn_strategies=UserTurnStrategies( + stop=[TurnAnalyzerUserTurnStopStrategy(turn_analyzer=LocalSmartTurnAnalyzerV3())] + ), + ), + ) - rtvi = RTVIProcessor(config=RTVIConfig(config=[])) + rtvi = RTVIProcessor() pipeline = Pipeline( [ transport.input(), # Transport user input rtvi, # RTVI processor stt, - context_aggregator.user(), # User responses + user_aggregator, # User responses llm, # LLM tts, # TTS transport.output(), # Transport bot output - context_aggregator.assistant(), # Assistant spoken responses + assistant_aggregator, # Assistant spoken responses ] ) @@ -130,13 +144,11 @@ async def bot(runner_args: RunnerArguments): audio_in_enabled=True, audio_out_enabled=True, vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)), - turn_analyzer=LocalSmartTurnAnalyzerV3(), ), "webrtc": lambda: TransportParams( audio_in_enabled=True, audio_out_enabled=True, vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)), - turn_analyzer=LocalSmartTurnAnalyzerV3(), ), }