diff --git a/changelog/3429.added.md b/changelog/3429.added.md new file mode 100644 index 000000000..905dcac78 --- /dev/null +++ b/changelog/3429.added.md @@ -0,0 +1 @@ +- Added handling for `server_content.interrupted` signal in the Gemini Live service for faster interruption response in the case where there isn't already turn tracking in the pipeline, e.g. local VAD + context aggregators. When there is already turn tracking in the pipeline, the additional interruption does no harm. diff --git a/src/pipecat/services/google/gemini_live/llm.py b/src/pipecat/services/google/gemini_live/llm.py index f61c9826c..895489955 100644 --- a/src/pipecat/services/google/gemini_live/llm.py +++ b/src/pipecat/services/google/gemini_live/llm.py @@ -1198,7 +1198,20 @@ class GeminiLiveLLMService(LLMService): # Reset failure counter if connection has been stable self._check_and_reset_failure_counter() - if message.server_content and message.server_content.model_turn: + if message.server_content and message.server_content.interrupted: + # NOTE: while the service triggers interruptions in + # the specific case of barge-ins, it does *not* + # emit UserStarted/StoppedSpeakingFrames, as the + # Gemini Live API does not give us broadly reliable + # signals to base those off of. Pipelines that + # require turn tracking (like those using context + # aggregators) still need an independent way to + # track turns, such as local Silero VAD in + # combination with the context aggregator default + # turn strategies. + logger.debug("Gemini VAD: interrupted signal received") + await self.push_interruption_task_frame_and_wait() + elif message.server_content and message.server_content.model_turn: await self._handle_msg_model_turn(message) elif ( message.server_content