From 4a32aa5266a6b7dd37ca3409ea0284eba7b11781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 19 Dec 2025 09:14:29 -0800 Subject: [PATCH] TurnAnalyzerBotTurnStartStrategy: don't use text on interim transcriptions --- .../turns/bot/turn_analyzer_bot_turn_start_strategy.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pipecat/turns/bot/turn_analyzer_bot_turn_start_strategy.py b/src/pipecat/turns/bot/turn_analyzer_bot_turn_start_strategy.py index 5d2aaf020..b96b347a4 100644 --- a/src/pipecat/turns/bot/turn_analyzer_bot_turn_start_strategy.py +++ b/src/pipecat/turns/bot/turn_analyzer_bot_turn_start_strategy.py @@ -89,8 +89,10 @@ class TurnAnalyzerBotTurnStartStrategy(BaseBotTurnStartStrategy): await self._handle_vad_user_stopped_speaking(frame) elif isinstance(frame, InputAudioRawFrame): await self._handle_input_audio(frame) - elif isinstance(frame, (TranscriptionFrame, InterimTranscriptionFrame)): + elif isinstance(frame, TranscriptionFrame): await self._handle_transcription(frame) + elif isinstance(frame, InterimTranscriptionFrame): + await self._handle_interim_transcription(frame) async def _start(self, frame: StartFrame): """Process the start frame to configure the turn analyzer.""" @@ -116,12 +118,16 @@ class TurnAnalyzerBotTurnStartStrategy(BaseBotTurnStartStrategy): await self._handle_prediction_result(prediction) await self._handle_end_of_turn(state) - async def _handle_transcription(self, frame: TranscriptionFrame | InterimTranscriptionFrame): + async def _handle_transcription(self, frame: TranscriptionFrame): """Handle user transcription.""" # We don't really care about the content. self._text = frame.text self._event.set() + async def _handle_interim_transcription(self, frame: InterimTranscriptionFrame): + """Handle user interim transcription.""" + self._event.set() + async def _handle_end_of_turn(self, state: EndOfTurnState): """Handle completion of end-of-turn analysis.""" if state == EndOfTurnState.COMPLETE: