From 40f2ed41e9795dec9d4e094afa58e52a97ca7cc3 Mon Sep 17 00:00:00 2001 From: Kwindla Hultman Kramer Date: Mon, 24 Jun 2024 01:37:19 +0000 Subject: [PATCH] bot-runner-ified classic-pipelinepy --- examples/fast-bot-metrics/classic-pipeline.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/fast-bot-metrics/classic-pipeline.py b/examples/fast-bot-metrics/classic-pipeline.py index f6232d235..2751f0a9f 100644 --- a/examples/fast-bot-metrics/classic-pipeline.py +++ b/examples/fast-bot-metrics/classic-pipeline.py @@ -24,7 +24,7 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.pipeline import Pipeline from pipecat.processors.logger import FrameLogger -from pipecat.frames.frames import LLMMessagesFrame +from pipecat.frames.frames import LLMMessagesFrame, EndFrame from pipecat.processors.aggregators.llm_response import ( LLMAssistantResponseAggregator, LLMUserResponseAggregator @@ -141,6 +141,11 @@ Respond to what the user said in a creative and helpful way. Be concise in your # async def on_participant_joined(transport, participant): # transport.capture_participant_transcription(participant["id"]) + # When the participant leaves, we exit the bot. + @transport.event_handler("on_participant_left") + async def on_participant_left(transport, participant, reason): + await task.queue_frame(EndFrame()) + # When the first participant joins, the bot should introduce itself. @ transport.event_handler("on_first_participant_joined") async def on_first_participant_joined(transport, participant):