From 11119430cd5e69a10c4730dcd630d659ab745ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 7 Aug 2025 13:36:45 -0700 Subject: [PATCH] TTSService: deprecate say() method --- CHANGELOG.md | 7 ++++++- src/pipecat/services/tts_service.py | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4d47273..b41efdcf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +- `TTSService.say()` is deprecated, push a `TTSSpeakFrame` instead. Calling + functions directly is a discouraged pattern in Pipecat because, for example, + it might cause issues with frame ordering. + - `LLMMessagesFrame` is deprecated, in favor of either: - `LLMMessagesUpdateFrame` with `run_llm=True` @@ -67,7 +71,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added Chinese, Japanese, Korean word timestamp support to `CartesiaTTSService`. -- Added `region` parameter to `GladiaSTTService`. Accepted values: eu-west (default), us-west. +- Added `region` parameter to `GladiaSTTService`. Accepted values: eu-west + (default), us-west. ### Changed diff --git a/src/pipecat/services/tts_service.py b/src/pipecat/services/tts_service.py index bcb485d33..9be28f319 100644 --- a/src/pipecat/services/tts_service.py +++ b/src/pipecat/services/tts_service.py @@ -269,9 +269,20 @@ class TTSService(AIService): async def say(self, text: str): """Immediately speak the provided text. + .. deprecated:: 0.0.79 + Push a `TTSSpeakFrame` instead to ensure frame ordering is maintained. + Args: text: The text to speak. """ + import warnings + + warnings.warn( + "`TTSService.say()` is deprecated. Push a `TTSSpeakFrame` instead.", + DeprecationWarning, + stacklevel=2, + ) + await self.queue_frame(TTSSpeakFrame(text)) async def process_frame(self, frame: Frame, direction: FrameDirection):