Uh oh!
There was an error while loading. Please reload this page.
feat: support audio_stream_end for realtime input - #6699
Merged
Conversation
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
Uh oh!
There was an error while loading. Please reload this page.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backports commit 0f738a5 (PR #4490,
feat: support audio_stream_end for realtime input, PiperOrigin-RevId: 956638801) frommaintov1.Problem:
send_realtimemethod only acceptedBlob(audio/video bytes),ActivityStart, andActivityEnd. There's no mechanism to send theaudioStreamEndboolean field, which is required to flush cached audio when Voice Activity Detection (VAD) is enabled.Solution:
This PR updates
GeminiLlmConnection,BaseLlmFlow, andLiveRequestQueueto support sending genericLiveClientRealtimeInputmessages withaudio_stream_endfield configured to the Gemini Live API. This closes#2887.Testing Plan
Unit Tests:
test_send_realtime_audio_stream_endtest_send_realtime_unsupported_liveClientRealtimeInputpytest 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.