diff --git a/examples/foundational/22b-natural-conversation-proposal.py b/examples/foundational/22b-natural-conversation-proposal.py index 256a6c9df..9a6d22494 100644 --- a/examples/foundational/22b-natural-conversation-proposal.py +++ b/examples/foundational/22b-natural-conversation-proposal.py @@ -119,7 +119,7 @@ class CompletenessCheck(FrameProcessor): if isinstance(frame, TextFrame) and frame.text == "YES": logger.debug("Completeness check YES") - await self.push_frame(UserStoppedSpeakingFrame()) + await self.broadcast_frame(UserStoppedSpeakingFrame) await self._notifier.notify() elif isinstance(frame, TextFrame) and frame.text == "NO": logger.debug("Completeness check NO") diff --git a/examples/foundational/22c-natural-conversation-mixed-llms.py b/examples/foundational/22c-natural-conversation-mixed-llms.py index bdb557594..935aa5e36 100644 --- a/examples/foundational/22c-natural-conversation-mixed-llms.py +++ b/examples/foundational/22c-natural-conversation-mixed-llms.py @@ -322,7 +322,7 @@ class CompletenessCheck(FrameProcessor): if isinstance(frame, TextFrame) and frame.text == "YES": logger.debug("!!! Completeness check YES") - await self.push_frame(UserStoppedSpeakingFrame()) + await self.broadcast_frame(UserStoppedSpeakingFrame) await self._notifier.notify() elif isinstance(frame, TextFrame) and frame.text == "NO": logger.debug("!!! Completeness check NO") diff --git a/examples/foundational/22d-natural-conversation-gemini-audio.py b/examples/foundational/22d-natural-conversation-gemini-audio.py index b144f485e..4a7c33a39 100644 --- a/examples/foundational/22d-natural-conversation-gemini-audio.py +++ b/examples/foundational/22d-natural-conversation-gemini-audio.py @@ -451,7 +451,7 @@ class CompletenessCheck(FrameProcessor): logger.debug("Completeness check YES") if self._idle_task: await self.cancel_task(self._idle_task) - await self.push_frame(UserStoppedSpeakingFrame()) + await self.broadcast_frame(UserStoppedSpeakingFrame) await self._audio_accumulator.reset() await self._notifier.notify() elif isinstance(frame, TextFrame): diff --git a/src/pipecat/services/aws/nova_sonic/llm.py b/src/pipecat/services/aws/nova_sonic/llm.py index 26afc79cf..14ebde729 100644 --- a/src/pipecat/services/aws/nova_sonic/llm.py +++ b/src/pipecat/services/aws/nova_sonic/llm.py @@ -1187,7 +1187,7 @@ class AWSNovaSonicLLMService(LLMService): logger.debug( "Wrapping assistant response trigger transcription with upstream UserStarted/StoppedSpeakingFrames" ) - await self.push_frame(UserStartedSpeakingFrame(), direction=FrameDirection.UPSTREAM) + await self.broadcast_frame(UserStartedSpeakingFrame) # Send the transcription upstream for the user context aggregator frame = TranscriptionFrame( @@ -1197,7 +1197,7 @@ class AWSNovaSonicLLMService(LLMService): # Finish wrapping the upstream transcription in UserStarted/StoppedSpeakingFrames if needed if should_wrap_in_user_started_stopped_speaking_frames: - await self.push_frame(UserStoppedSpeakingFrame(), direction=FrameDirection.UPSTREAM) + await self.broadcast_frame(UserStoppedSpeakingFrame) # Clear out the buffered user text self._user_text_buffer = "" diff --git a/src/pipecat/services/deepgram/flux/stt.py b/src/pipecat/services/deepgram/flux/stt.py index 13b72bcf7..35b00af65 100644 --- a/src/pipecat/services/deepgram/flux/stt.py +++ b/src/pipecat/services/deepgram/flux/stt.py @@ -676,8 +676,7 @@ class DeepgramFluxSTTService(WebsocketSTTService): await self._handle_transcription(transcript, True, self._language) await self.stop_processing_metrics() - await self.push_frame(UserStoppedSpeakingFrame(), FrameDirection.DOWNSTREAM) - await self.push_frame(UserStoppedSpeakingFrame(), FrameDirection.UPSTREAM) + await self.broadcast_frame(UserStoppedSpeakingFrame) await self._call_event_handler("on_end_of_turn", transcript) async def _handle_eager_end_of_turn(self, transcript: str, data: Dict[str, Any]): diff --git a/src/pipecat/services/grok/realtime/llm.py b/src/pipecat/services/grok/realtime/llm.py index cbf9b4d5c..bcd701cd3 100644 --- a/src/pipecat/services/grok/realtime/llm.py +++ b/src/pipecat/services/grok/realtime/llm.py @@ -659,7 +659,7 @@ class GrokRealtimeLLMService(LLMService): """Handle speech stopped event from VAD.""" await self.start_ttfb_metrics() await self.start_processing_metrics() - await self.push_frame(UserStoppedSpeakingFrame()) + await self.broadcast_frame(UserStoppedSpeakingFrame) async def _handle_evt_error(self, evt): """Handle error event.""" diff --git a/src/pipecat/services/openai/realtime/llm.py b/src/pipecat/services/openai/realtime/llm.py index 598d4f510..7c48d7e34 100644 --- a/src/pipecat/services/openai/realtime/llm.py +++ b/src/pipecat/services/openai/realtime/llm.py @@ -776,7 +776,7 @@ class OpenAIRealtimeLLMService(LLMService): async def _handle_evt_speech_stopped(self, evt): await self.start_ttfb_metrics() await self.start_processing_metrics() - await self.push_frame(UserStoppedSpeakingFrame()) + await self.broadcast_frame(UserStoppedSpeakingFrame) async def _maybe_handle_evt_retrieve_conversation_item_error(self, evt: events.ErrorEvent): """Maybe handle an error event related to retrieving a conversation item. diff --git a/src/pipecat/services/openai_realtime_beta/openai.py b/src/pipecat/services/openai_realtime_beta/openai.py index bea26c3e6..128bcc93a 100644 --- a/src/pipecat/services/openai_realtime_beta/openai.py +++ b/src/pipecat/services/openai_realtime_beta/openai.py @@ -662,7 +662,7 @@ class OpenAIRealtimeBetaLLMService(LLMService): async def _handle_evt_speech_stopped(self, evt): await self.start_ttfb_metrics() await self.start_processing_metrics() - await self.push_frame(UserStoppedSpeakingFrame()) + await self.broadcast_frame(UserStoppedSpeakingFrame) async def _maybe_handle_evt_retrieve_conversation_item_error(self, evt: events.ErrorEvent): """Maybe handle an error event related to retrieving a conversation item.