From 410a6b9238ef1fc1935c9e14969098b9fcb6d9cf Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 22 Feb 2025 14:38:14 -0800 Subject: [PATCH] moved terminate call to handlers class --- examples/phone-chatbot/bot_daily_gemini.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/phone-chatbot/bot_daily_gemini.py b/examples/phone-chatbot/bot_daily_gemini.py index 5d816cec8..100b46fe9 100644 --- a/examples/phone-chatbot/bot_daily_gemini.py +++ b/examples/phone-chatbot/bot_daily_gemini.py @@ -13,7 +13,7 @@ from dotenv import load_dotenv from loguru import logger from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.frames.frames import EndTaskFrame +from pipecat.frames.frames import BotStoppedSpeakingFrame, EndTaskFrame, Frame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask @@ -96,13 +96,12 @@ class FunctionHandlers: await result_callback("Talking to the customer") + async def terminate_call( + function_name, tool_call_id, args, llm: LLMService, context, result_callback + ): + """Function the bot can call to terminate the call upon completion of the call.""" -async def terminate_call( - function_name, tool_call_id, args, llm: LLMService, context, result_callback -): - """Function the bot can call to terminate the call upon completion of the call.""" - - await llm.queue_frame(EndTaskFrame(), FrameDirection.UPSTREAM) + await llm.queue_frame(EndTaskFrame(), FrameDirection.UPSTREAM) async def main( @@ -213,7 +212,7 @@ DO NOT say anything until you've determined if this is a voicemail or human.""" llm.register_function("switch_to_voicemail_response", handlers.voicemail_response) llm.register_function("switch_to_human_conversation", handlers.human_conversation) - llm.register_function("terminate_call", terminate_call) + llm.register_function("terminate_call", handlers.terminate_call) pipeline = Pipeline( [