Skip to content

Support audioStreamEnd in send_realtime for realtimeInput - #6508

Closed
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-2887-6620
Closed

Support audioStreamEnd in send_realtime for realtimeInput#6508
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-2887-6620

Conversation

@guptaishaan

Copy link
Copy Markdown
Contributor

The Gemini Live API's send_realtime_input accepts an audio_stream_end parameter (a boolean flag) that forces the model to flush any buffered audio immediately when VAD (voice activity detection) is enabled. This is useful when the client wants to signal the definitive end of an audio stream without waiting for VAD to detect silence.

This change threads audio_stream_end support through all three relevant layers:

  1. LiveRequest (live_request_queue.py): adds an audio_stream_end: Optional[bool] field alongside the existing activity_start/activity_end fields, and exposes a send_audio_stream_end() convenience method on LiveRequestQueue.
  2. base_llm_flow.py: handles the new audio_stream_end field from LiveRequest by calling llm_connection.send_realtime(True).
  3. GeminiLlmConnection.send_realtime (gemini_llm_connection.py): when the input is the boolean True, calls session.send_realtime_input(audio_stream_end=True) to forward the signal to the Gemini API.

A regression test verifies that calling send_realtime(True) correctly invokes send_realtime_input(audio_stream_end=True) on the underlying session.

Fixes#2887

The Gemini Live API's `send_realtime_input` accepts an `audio_stream_end` parameter (a boolean flag) that forces the model to flush any buffered audio immediately when VAD (voice activity detection) is enabled. This is useful when the client wants to signal the definitive end of an audio stream without waiting for VAD to detect silence.
Signed-off-by: Ishaan <ishaangupta0408@gmail.com>
@adk-botadk-bot added the live [Component] This issue is related to live, voice and video chat label Jul 29, 2026
@wuliang229

Copy link
Copy Markdown
Collaborator

Hi @guptaishaan. Thanks for the PR. We are reviewing #4490 and will go with that one.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

live[Component] This issue is related to live, voice and video chat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support gemini audioStreamEnd for realtimeInput

3 participants

@guptaishaan@wuliang229@adk-bot