From 68c9c017478840b2d12a811143f34882b862143e Mon Sep 17 00:00:00 2001 From: filipi87 Date: Thu, 8 Jan 2026 10:44:53 -0300 Subject: [PATCH] =?UTF-8?q?Allows=20defining=20whether=20Flux=20should=20s?= =?UTF-8?q?end=20an=20interruption=20when=20the=20user=E2=80=99s=20turn=20?= =?UTF-8?q?has=20started.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pipecat/services/deepgram/flux/stt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pipecat/services/deepgram/flux/stt.py b/src/pipecat/services/deepgram/flux/stt.py index 17f970587..cc2df29e2 100644 --- a/src/pipecat/services/deepgram/flux/stt.py +++ b/src/pipecat/services/deepgram/flux/stt.py @@ -116,6 +116,7 @@ class DeepgramFluxSTTService(WebsocketSTTService): model: str = "flux-general-en", flux_encoding: str = "linear16", params: Optional[InputParams] = None, + should_interrupt: bool = True, **kwargs, ): """Initialize the Deepgram Flux STT service. @@ -129,6 +130,7 @@ class DeepgramFluxSTTService(WebsocketSTTService): Raw signed little-endian 16-bit PCM encoding. params: InputParams instance containing detailed API configuration options. If None, default parameters will be used. + should_interrupt: Determine whether the bot should be interrupted when Flux detects that the user is speaking. **kwargs: Additional arguments passed to the parent WebsocketSTTService class. Examples: @@ -166,6 +168,7 @@ class DeepgramFluxSTTService(WebsocketSTTService): self._url = url self._model = model self._params = params or DeepgramFluxSTTService.InputParams() + self._should_interrupt = should_interrupt self._flux_encoding = flux_encoding # This is the currently only supported language self._language = Language.EN @@ -592,7 +595,8 @@ class DeepgramFluxSTTService(WebsocketSTTService): logger.debug("User started speaking") self._user_is_speaking = True await self.broadcast_frame(UserStartedSpeakingFrame) - await self.push_interruption_task_frame_and_wait() + if self._should_interrupt: + await self.push_interruption_task_frame_and_wait() await self.start_metrics() await self._call_event_handler("on_start_of_turn", transcript) if transcript: