diff --git a/examples/simple-chatbot/server/bot-gemini.py b/examples/simple-chatbot/server/bot-gemini.py index 991df1cd1..c233f46dd 100644 --- a/examples/simple-chatbot/server/bot-gemini.py +++ b/examples/simple-chatbot/server/bot-gemini.py @@ -42,6 +42,8 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.processors.frameworks.rtvi import ( + RTVIProcessor, + RTVIConfig, RTVIBotTranscriptionProcessor, RTVIMetricsProcessor, RTVISpeakingProcessor, @@ -179,9 +181,13 @@ async def main(): # This will send `metrics` messages. rtvi_metrics = RTVIMetricsProcessor() + # Handles RTVI messages from the client + rtvi = RTVIProcessor(config=RTVIConfig(config=[])) + pipeline = Pipeline( [ transport.input(), + rtvi, context_aggregator.user(), llm, rtvi_speaking, @@ -204,6 +210,10 @@ async def main(): ) await task.queue_frame(quiet_frame) + @rtvi.event_handler("on_client_ready") + async def on_client_ready(rtvi): + await rtvi.set_bot_ready() + @transport.event_handler("on_first_participant_joined") async def on_first_participant_joined(transport, participant): await transport.capture_participant_transcription(participant["id"]) diff --git a/examples/simple-chatbot/server/bot-openai.py b/examples/simple-chatbot/server/bot-openai.py index a3a68c839..a328bfb3a 100644 --- a/examples/simple-chatbot/server/bot-openai.py +++ b/examples/simple-chatbot/server/bot-openai.py @@ -43,10 +43,12 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.processors.frameworks.rtvi import ( + RTVIProcessor, RTVIBotTranscriptionProcessor, RTVIMetricsProcessor, RTVISpeakingProcessor, RTVIUserTranscriptionProcessor, + RTVIConfig, ) from pipecat.services.elevenlabs import ElevenLabsTTSService from pipecat.services.openai import OpenAILLMService @@ -201,9 +203,13 @@ async def main(): # This will send `metrics` messages. rtvi_metrics = RTVIMetricsProcessor() + # Handles RTVI messages from the client + rtvi = RTVIProcessor(config=RTVIConfig(config=[])) + pipeline = Pipeline( [ transport.input(), + rtvi, rtvi_speaking, rtvi_user_transcription, context_aggregator.user(), @@ -227,6 +233,10 @@ async def main(): ) await task.queue_frame(quiet_frame) + @rtvi.event_handler("on_client_ready") + async def on_client_ready(rtvi): + await rtvi.set_bot_ready() + @transport.event_handler("on_first_participant_joined") async def on_first_participant_joined(transport, participant): await transport.capture_participant_transcription(participant["id"])