From ad1bec458374827432c25ea24cf9f27bc8918f56 Mon Sep 17 00:00:00 2001 From: filipi87 Date: Tue, 10 Feb 2026 11:28:35 -0300 Subject: [PATCH] Updated openai example to use on_tts_request and append_to_text. --- examples/foundational/14d-function-calling-openai-video.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/foundational/14d-function-calling-openai-video.py b/examples/foundational/14d-function-calling-openai-video.py index 88c0e8ba3..d948e9caa 100644 --- a/examples/foundational/14d-function-calling-openai-video.py +++ b/examples/foundational/14d-function-calling-openai-video.py @@ -99,7 +99,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): @llm.event_handler("on_function_calls_started") async def on_function_calls_started(service, function_calls): - await tts.queue_frame(TTSSpeakFrame("Let me check on that.")) + await tts.queue_frame(TTSSpeakFrame("Let me check on that.", append_to_context=False)) fetch_image_function = FunctionSchema( name="fetch_user_image", @@ -174,6 +174,10 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): logger.info(f"Client disconnected") await task.cancel() + @tts.event_handler("on_tts_request") + async def on_tts_request(tts, context_id: str, text: str): + logger.debug(f"On TTS request: {context_id}: {text}") + runner = PipelineRunner(handle_sigint=runner_args.handle_sigint) await runner.run(task)