diff --git a/src/pipecat/services/tts_service.py b/src/pipecat/services/tts_service.py index f0d602a405..392c1e83f0 100644 --- a/src/pipecat/services/tts_service.py +++ b/src/pipecat/services/tts_service.py @@ -364,7 +364,10 @@ async def process_frame(self, frame: Frame, direction: FrameDirection): sentence, includes_inter_frame_spaces=includes_inter_frame_spaces ) if isinstance(frame, LLMFullResponseEndFrame): - if self._push_text_frames: + # Ensure the sentence is not empty. In some cases, such as function calling, the + # LLMFullResponseEndFrame may never be pushed into the pipeline, which would + # cause issues if we proceed without "or not sentence" this check. + if self._push_text_frames or not sentence: await self.push_frame(frame, direction) else: await self.push_frame(frame, direction)