diff --git a/examples/foundational/07c-interruptible-deepgram-vad.py b/examples/foundational/07c-interruptible-deepgram-vad.py index 22498afe9..d9cdd8953 100644 --- a/examples/foundational/07c-interruptible-deepgram-vad.py +++ b/examples/foundational/07c-interruptible-deepgram-vad.py @@ -98,7 +98,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): @stt.event_handler("on_speech_started") async def on_speech_started(stt, *args, **kwargs): - await task.queue_frames([InterruptionFrame(), UserStartedSpeakingFrame()]) + await task.queue_frames([UserStartedSpeakingFrame(), InterruptionFrame()]) @stt.event_handler("on_utterance_end") async def on_utterance_end(stt, *args, **kwargs): diff --git a/src/pipecat/services/deepgram/flux/stt.py b/src/pipecat/services/deepgram/flux/stt.py index 74e9d1053..81f0b0e2b 100644 --- a/src/pipecat/services/deepgram/flux/stt.py +++ b/src/pipecat/services/deepgram/flux/stt.py @@ -591,8 +591,8 @@ class DeepgramFluxSTTService(WebsocketSTTService): """ logger.debug("User started speaking") self._user_is_speaking = True - await self.push_interruption_task_frame_and_wait() await self.broadcast_frame(UserStartedSpeakingFrame) + await self.push_interruption_task_frame_and_wait() await self.start_metrics() await self._call_event_handler("on_start_of_turn", transcript) if transcript: diff --git a/src/pipecat/services/grok/realtime/llm.py b/src/pipecat/services/grok/realtime/llm.py index acbb3f83c..de03b4636 100644 --- a/src/pipecat/services/grok/realtime/llm.py +++ b/src/pipecat/services/grok/realtime/llm.py @@ -652,8 +652,8 @@ class GrokRealtimeLLMService(LLMService): async def _handle_evt_speech_started(self, evt): """Handle speech started event from VAD.""" await self._truncate_current_audio_response() + await self.broadcast_frame(UserStartedSpeakingFrame) await self.push_interruption_task_frame_and_wait() - await self.push_frame(UserStartedSpeakingFrame()) async def _handle_evt_speech_stopped(self, evt): """Handle speech stopped event from VAD.""" diff --git a/src/pipecat/services/openai/realtime/llm.py b/src/pipecat/services/openai/realtime/llm.py index c7bc40bce..26b5fd743 100644 --- a/src/pipecat/services/openai/realtime/llm.py +++ b/src/pipecat/services/openai/realtime/llm.py @@ -735,8 +735,8 @@ class OpenAIRealtimeLLMService(LLMService): async def _handle_evt_speech_started(self, evt): await self._truncate_current_audio_response() + await self.broadcast_frame(UserStartedSpeakingFrame) await self.push_interruption_task_frame_and_wait() - await self.push_frame(UserStartedSpeakingFrame()) async def _handle_evt_speech_stopped(self, evt): await self.start_ttfb_metrics() diff --git a/src/pipecat/services/openai_realtime_beta/openai.py b/src/pipecat/services/openai_realtime_beta/openai.py index 16a00d08f..f77c63383 100644 --- a/src/pipecat/services/openai_realtime_beta/openai.py +++ b/src/pipecat/services/openai_realtime_beta/openai.py @@ -656,8 +656,8 @@ class OpenAIRealtimeBetaLLMService(LLMService): async def _handle_evt_speech_started(self, evt): await self._truncate_current_audio_response() + await self.broadcast_frame(UserStartedSpeakingFrame) await self.push_interruption_task_frame_and_wait() - await self.push_frame(UserStartedSpeakingFrame()) async def _handle_evt_speech_stopped(self, evt): await self.start_ttfb_metrics() diff --git a/src/pipecat/services/speechmatics/stt.py b/src/pipecat/services/speechmatics/stt.py index 3efa20d84..f779f0e77 100644 --- a/src/pipecat/services/speechmatics/stt.py +++ b/src/pipecat/services/speechmatics/stt.py @@ -604,8 +604,8 @@ class SpeechmaticsSTTService(STTService): message: the message payload. """ logger.debug(f"{self} StartOfTurn received") - await self.push_interruption_task_frame_and_wait() await self.broadcast_frame(UserStartedSpeakingFrame) + await self.push_interruption_task_frame_and_wait() # await self.start_processing_metrics() async def _handle_end_of_turn(self, message: dict[str, Any]) -> None: