feat: add Gemini 3.1 Flash Live support for run_live()#5076
Open
imazizongit wants to merge 1 commit intogoogle:mainfrom
Open
feat: add Gemini 3.1 Flash Live support for run_live()#5076imazizongit wants to merge 1 commit intogoogle:mainfrom
imazizongit wants to merge 1 commit intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Changes: 1. send_realtime(): use audio= instead of deprecated media= (all models) 2. send_content(): use send_tool_response() for function responses (all models) 3. send_content(): route text via send_realtime_input for 3.1 models 4. connect(): inject history_config for 3.1 models Changes 1-2 are backward-compatible API upgrades (removing deprecated usage). Changes 3-4 are conditional on model version containing '3.1'. Tested in production with real phone calls on gemini-3.1-flash-live-preview. Note: 3.1 models do not support enable_affective_dialog, context_window_compression, or proactivity config fields. These are documented in issue google#5075 as model limitations. Fixes google#5018
e591734 to
b6cc92a
Compare
Collaborator
|
Response from ADK Triaging Agent Hello @imazizongit, thank you for your contribution! Before we can merge this pull request, you'll need to sign the Contributor License Agreement (CLA). Please check the pull request status checks for a link to the CLA. Thanks! |
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 free
to 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
Adds support for
gemini-3.1-flash-live-previewin ADK's bidi-streaming pipeline (run_live()). Without these changes, 3.1 models fail with WebSocket errors (1007/1008/1011).Changes
Backward-compatible upgrades (all models)
send_realtime(): Useaudio=instead of deprecatedmedia=parameter insend_realtime_input(). Themedia=parameter produces the deprecatedmediaChunkswire format which 3.1 rejects. Theaudio=parameter works on all models.send_content(): Usesend_tool_response()instead ofsession.send(LiveClientToolResponse(...))for function responses. This is the current non-deprecated API.3.1-specific changes (conditional on
model_version)send_content()text routing: 3.1 models rejectLiveClientContentfor mid-conversation text with error1007: Request contains an invalid argument. Text content is routed throughsend_realtime_input(text=...)whenmodel_versioncontains "3.1". Uses the existingself._model_versionfield.connect()history_config: 3.1 models requireHistoryConfig(initial_history_in_client_content=True)for session history. Injected inGemini.connect()when model contains "3.1" and not already set by the caller.Not included (model limitations, documented in #5075)
The following
LiveConnectConfigfields are not supported by 3.1 models and will cause connection errors:enable_affective_dialog(1011 Internal error)context_window_compression(1007 Invalid argument)proactivity(1007 Unknown name)These are model API limitations, not ADK bugs. Users should not set these fields when using 3.1 models.
Testing
Related