Skip to content

feat: support audio_stream_end for realtime input - #6699

Merged
wuliang229 merged 1 commit into
v1from
port-v1-audio-stream-end
Aug 12, 2026
Merged

feat: support audio_stream_end for realtime input#6699
wuliang229 merged 1 commit into
v1from
port-v1-audio-stream-end

Conversation

@wuliang229

Copy link
Copy Markdown
Collaborator

Summary

Backports commit 0f738a5 (PR #4490, feat: support audio_stream_end for realtime input, PiperOrigin-RevId: 956638801) from main to v1.

Problem:
send_realtime method only accepted Blob (audio/video bytes), ActivityStart, and ActivityEnd. There's no mechanism to send the audioStreamEnd boolean field, which is required to flush cached audio when Voice Activity Detection (VAD) is enabled.

Solution:
This PR updates GeminiLlmConnection, BaseLlmFlow, and LiveRequestQueue to support sending generic LiveClientRealtimeInput messages with audio_stream_end field configured to the Gemini Live API. This closes#2887.

Testing Plan

Unit Tests:

  • Added unit tests:
    • test_send_realtime_audio_stream_end
    • test_send_realtime_unsupported_liveClientRealtimeInput
  • All unit tests pass locally:
    • pytest tests/unittests/models/test_gemini_llm_connection.py (46 passed)
    • pytest tests/unittests/agents/test_live_request_queue.py tests/unittests/flows/ (431 passed)
  • pre-commit (isort, pyink, addlicense) clean.

Merge #4490
**Problem:**
`send_realtime` method only accepted `Blob` (audio/video bytes), `ActivityStart`, and `ActivityEnd`. There's no mechanism to send the `audioStreamEnd` boolean field, which is required to flush cached audio when Voice Activity Detection ([VAD](https://ai.google.dev/gemini-api/docs/live-guide#interruptions)) is enabled.
**Solution:**
This PR updates the `GeminiLlmConnection`, `BaseLlmFlow`, and `LiveRequestQueue` to support sending generic `LiveClientRealtimeInput` messages with `audio_stream_end` field configured to the [Gemini Live API](https://googleapis.github.io/python-genai/genai.html#genai.live.AsyncSession.send_realtime_input). This closes#2887.
**Unit Tests:**
- added unit test `test_send_realtime_audiostreamend`
- all unit tests passing locally
- processing priority: activity_start > activity_end > audio_stream_end > blob > content
- this is to follows the principal of control signals > data payloads, since `audio_stream_end` is a signal to flush the audio buffer
Co-authored-by: Liang Wu <wuliang@google.com>
COPYBARA_INTEGRATE_REVIEW=#4490 from lottielin:support-audio-stream-end ea6d2df
PiperOrigin-RevId: 956638801
@adk-botadk-bot added the live [Component] This issue is related to live, voice and video chat label Aug 12, 2026
@wuliang229
wuliang229 merged commit 5e3b997 into v1Aug 12, 2026
14 checks passed
@wuliang229
wuliang229 deleted the port-v1-audio-stream-end branch August 16, 2026 22:03
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.

3 participants

@wuliang229@adk-bot@lottielin