From 05b9c514fb5ca857c80bd0d89a3092df60972014 Mon Sep 17 00:00:00 2001 From: filipi87 Date: Tue, 24 Mar 2026 12:39:28 -0300 Subject: [PATCH 1/2] Invoking TTSSpeakFrame when we receive a TTSSpeakFrame. --- src/pipecat/services/tts_service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pipecat/services/tts_service.py b/src/pipecat/services/tts_service.py index 6d475bdc2..7a4f8dd24 100644 --- a/src/pipecat/services/tts_service.py +++ b/src/pipecat/services/tts_service.py @@ -661,7 +661,7 @@ class TTSService(AIService): Override to perform provider-specific setup (e.g., eagerly opening a server-side context) before text starts flowing. This is called from - ``process_frame`` when an ``LLMFullResponseStartFrame`` arrives. + ``process_frame`` when an ``LLMFullResponseStartFrame`` or ``TTSSpeakFrame`` arrives. Args: context_id: The newly created turn context ID. @@ -759,6 +759,7 @@ class TTSService(AIService): self._turn_context_id = None # Creating a new context_id for the TTS request. self._turn_context_id = self.create_context_id() + await self.on_turn_context_created(self._turn_context_id) # If we are not receiving text from the LLM, we can assume that the SpeakFrame should be automatically added to the context push_assistant_aggregation = frame.append_to_context and not self._llm_response_started # Assumption: text in TTSSpeakFrame does not include inter-frame spaces From 3274235ea1274367258a72c7a334ba4ec9768d46 Mon Sep 17 00:00:00 2001 From: filipi87 Date: Tue, 24 Mar 2026 12:42:56 -0300 Subject: [PATCH 2/2] Adding missing changelog entry. --- changelog/4013.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/4013.added.md diff --git a/changelog/4013.added.md b/changelog/4013.added.md new file mode 100644 index 000000000..1be433cb3 --- /dev/null +++ b/changelog/4013.added.md @@ -0,0 +1 @@ +- Added `on_turn_context_created(context_id)` hook to `TTSService`. Override this to perform provider-specific setup (e.g. eagerly opening a server-side context) before text starts flowing. Called each time a new turn context ID is created. \ No newline at end of file