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