From aa7e9a17d5ecdb3d934833e65dae56570bd8c0ca Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 27 Feb 2026 14:55:22 -0500 Subject: [PATCH] Fix finalization pattern: Use request/confirm in Pipecat mode, finalized flag in STT mode - Add request_finalize() before sending ForceEndpoint in Pipecat mode - Keep confirm_finalize() when receiving formatted finals in Pipecat mode - Remove confirm_finalize() from STT mode (use finalized=True instead) This follows Pipecat's two-step finalization pattern where request_finalize() is called when sending a finalize request to the STT service, and confirm_finalize() is called when receiving confirmation back. --- src/pipecat/services/assemblyai/stt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pipecat/services/assemblyai/stt.py b/src/pipecat/services/assemblyai/stt.py index 9881c145f..90e292ac0 100644 --- a/src/pipecat/services/assemblyai/stt.py +++ b/src/pipecat/services/assemblyai/stt.py @@ -438,6 +438,7 @@ class AssemblyAISTTService(WebsocketSTTService): and self._websocket and self._websocket.state is State.OPEN ): + await self.request_finalize() await self._websocket.send(json.dumps({"type": "ForceEndpoint"})) await self.start_processing_metrics() @@ -761,8 +762,7 @@ class AssemblyAISTTService(WebsocketSTTService): self._user_speaking = True if is_final_turn: - if message.turn_is_formatted: - self.confirm_finalize() + # STT mode: AssemblyAI controls finalization, just mark as finalized await self.push_frame( TranscriptionFrame( transcript_text,