From 91bc5236b566ab58e491f0360a1b9c70ab88d8f8 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Sun, 4 Jan 2026 08:50:51 -0500 Subject: [PATCH] Add trailing space to DeepgramTTSService text generation --- changelog/3345.fixed.md | 1 + src/pipecat/services/deepgram/tts.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelog/3345.fixed.md diff --git a/changelog/3345.fixed.md b/changelog/3345.fixed.md new file mode 100644 index 000000000..61c0a575e --- /dev/null +++ b/changelog/3345.fixed.md @@ -0,0 +1 @@ +- Fixed an issue with DeepgramTTSService where the model would output "Dot" instead of a period in some circumstances. diff --git a/src/pipecat/services/deepgram/tts.py b/src/pipecat/services/deepgram/tts.py index 82fd31cfd..674cb2919 100644 --- a/src/pipecat/services/deepgram/tts.py +++ b/src/pipecat/services/deepgram/tts.py @@ -287,7 +287,9 @@ class DeepgramTTSService(WebsocketTTSService): Yields: Frame: Audio frames containing the synthesized speech, plus start/stop frames. """ - logger.debug(f"{self}: Generating TTS [{text}]") + # Append trailing space to prevent TTS from vocalizing trailing periods as "dot" + text_with_trailing_space = text + " " + logger.debug(f"{self}: Generating TTS [{text_with_trailing_space}]") try: # Reconnect if the websocket is closed @@ -295,14 +297,14 @@ class DeepgramTTSService(WebsocketTTSService): await self._connect() await self.start_ttfb_metrics() - await self.start_tts_usage_metrics(text) + await self.start_tts_usage_metrics(text_with_trailing_space) yield TTSStartedFrame() # Send text message to Deepgram # Note: We don't send Flush here - that should only be sent when the # LLM finishes a complete response via flush_audio() - speak_msg = {"type": "Speak", "text": text} + speak_msg = {"type": "Speak", "text": text_with_trailing_space} await self._get_websocket().send(json.dumps(speak_msg)) # The audio frames will be handled in _receive_messages