From eb248fedc1286f89fa9cd9288b6db3932f4b7c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 26 Aug 2025 14:47:19 -0700 Subject: [PATCH] add skip_tts to LLMFullResponseStartFrame/LLMFullResponseEndFrame --- src/pipecat/frames/frames.py | 12 ++++++++++-- src/pipecat/services/llm_service.py | 5 +++-- src/pipecat/services/tts_service.py | 5 ++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index 5052c0df2..691a09f5b 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -1351,14 +1351,22 @@ class LLMFullResponseStartFrame(ControlFrame): more TextFrames and a final LLMFullResponseEndFrame. """ - pass + skip_tts: bool = field(init=False) + + def __post_init__(self): + super().__post_init__() + self.skip_tts = False @dataclass class LLMFullResponseEndFrame(ControlFrame): """Frame indicating the end of an LLM response.""" - pass + skip_tts: bool = field(init=False) + + def __post_init__(self): + super().__post_init__() + self.skip_tts = False @dataclass diff --git a/src/pipecat/services/llm_service.py b/src/pipecat/services/llm_service.py index 63f7659b3..a44f7ab26 100644 --- a/src/pipecat/services/llm_service.py +++ b/src/pipecat/services/llm_service.py @@ -14,7 +14,6 @@ from typing import ( Awaitable, Callable, Dict, - List, Mapping, Optional, Protocol, @@ -38,6 +37,8 @@ from pipecat.frames.frames import ( FunctionCallResultProperties, FunctionCallsStartedFrame, LLMConfigureOutputFrame, + LLMFullResponseEndFrame, + LLMFullResponseStartFrame, LLMTextFrame, StartFrame, StartInterruptionFrame, @@ -285,7 +286,7 @@ class LLMService(AIService): frame: The frame to push. direction: The direction of frame pushing. """ - if isinstance(frame, LLMTextFrame): + if isinstance(frame, (LLMTextFrame, LLMFullResponseStartFrame, LLMFullResponseEndFrame)): frame.skip_tts = self._skip_tts await super().push_frame(frame, direction) diff --git a/src/pipecat/services/tts_service.py b/src/pipecat/services/tts_service.py index afe5da62d..9e34adf25 100644 --- a/src/pipecat/services/tts_service.py +++ b/src/pipecat/services/tts_service.py @@ -296,7 +296,10 @@ class TTSService(AIService): """ await super().process_frame(frame, direction) - if isinstance(frame, TextFrame) and frame.skip_tts: + if ( + isinstance(frame, (TextFrame, LLMFullResponseStartFrame, LLMFullResponseEndFrame)) + and frame.skip_tts + ): await self.push_frame(frame, direction) elif ( isinstance(frame, TextFrame)