Fix: match adk-python in the Gemini 3.x Live model predicate - #715
Open
AmaadMartin wants to merge 2 commits into
Open
Fix: match adk-python in the Gemini 3.x Live model predicate#715AmaadMartin wants to merge 2 commits into
AmaadMartin wants to merge 2 commits into
Conversation
added 2 commits
August 6, 2026 04:01
isGemini3xFlashLive only matched the literal '-flash-live', so gemini-3.5-flash-lite-live-preview was not classified as a Gemini 3.x Live model. adk-python matches the substring '-live' and routes gemini-3.5-live-translate* to a separate predicate. Rename the predicate to isGemini3xLive, widen the match, and add isGemini35LiveTranslate for the exclusion. Both changes must ship together: widening the substring alone would make live-translate match. Reference: adk-python src/google/adk/utils/model_name_utils.py, _is_gemini_3_x_live and is_gemini_3_5_live_translate. BREAKING CHANGE: isGemini3xFlashLive is renamed to isGemini3xLive.
…e exclusion Add regression cases for gemini-3.5-flash-lite-live-preview at the predicate and at all four call sites, and for the gemini-3.5-live-translate exclusion. Add a describe block for isGemini35LiveTranslate mirroring adk-python TestIsGemini35LiveTranslate. All new coverage is in new it blocks; no existing assertion changed.
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
None.
Problem:
isGemini3xFlashLivematches the literal-flash-live, so it returnsfalseforgemini-3.5-flash-lite-live-preview.adk-pythonmatches the substring-liveand returnsTruefor that id.adk-pythonalso routesgemini-3.5-live-translate*out of the live predicate and into a separate public predicate, whichadk-jsdoes not have. The same model therefore drives a different live-session protocol depending on which SDK the user picked.Solution: I renamed the predicate to
isGemini3xLive, widened the match to-live, and addedisGemini35LiveTranslatefor the exclusion. The two parts must ship together: widening the substring alone would makegemini-3.5-live-translatematch. Reference:adk-pythonsrc/google/adk/utils/model_name_utils.py,_is_gemini_3_x_live(line 187) andis_gemini_3_5_live_translate(line 206). The mirrored shape is kept, including passing the rawmodelStringto the second predicate.BREAKING CHANGE:
isGemini3xFlashLiveis renamed toisGemini3xLive. Migration: replaceisGemini3xFlashLivewithisGemini3xLive. There is no deprecated alias. This repo renamed the same symbol the same way before,isGemini31FlashLive->isGemini3xFlashLivein google#409, with no alias. The old name is now actively misleading, because the predicate matches non-flashlive models.Behaviour changes for
gemini-3.5-flash-lite-live-preview(and anygemini-3.*live id without-flash-live), which flipsfalse->true:sendHistory:turnCompleteis now alwaystrueinstead of "last content role isuser".sendContent: a single text part goes out throughsendRealtimeInput({text})instead ofsendClientContent.sendRealtime:audio/*goes tosendRealtimeInput({audio})andimage/*tosendRealtimeInput({video})instead ofsendRealtimeInput({media}). An unknown mime type is now warned about and dropped.LiveResponseAggregator: tool calls are yielded ontoolCallinstead of buffered untilturnComplete.Nothing else changes.
gemini-3.5-live-translate*isfalsebefore and after, and a new test pins that.gemini-3.1-flash-live,gemini-2.5-flash-liveand every non-Gemini model keep their old value.Parity note:
adk-pythonalso routes live-translate audio and video throughsend_realtime_inputingemini_llm_connection.py:172. That is a call-site change, not a predicate change, so it is out of scope here and is tracked separately.Collision check: I listed all 710 pull requests on the fork and diffed every one that touches
core/src/utils/model_name.ts(#372, #471, #615, #617, #618). None of them touches the live predicate; they changeextractModelName, the Gemini-1 boundary and the EAP gate.git log --all -Sfinds no commit that introducesisGemini3xLiveorisGemini35LiveTranslate.Testing Plan
Unit Tests:
New line and branch coverage on
core/src/utils/model_name.tslines 106-131 is 100%, measured with@vitest/coverage-v8.The edits to the existing
model_name_test.tsandgemini_llm_connection_test.tsblocks are a symbol rename and one title rename. No existing assertion or expected value changed. All new coverage is in newitblocks.I proved the new tests can fail with two mutations of
core/src/utils/model_name.ts.Mutation 1, restore the old narrow substring (
startsWith('gemini-3.') && includes('-flash-live')). Five tests failed:Mutation 2, delete only
&& !isGemini35LiveTranslate(modelString). Two tests failed:Mutation 2 is invisible to the old narrow code path. It only becomes reachable once the substring is widened, which is why both parts ship in one change.
Other local checks on the pushed commit:
npm run ts:checkdoes not pass onmaineither. It reports 280 errors on this checkout before and after my change, so my change adds none. The cause is the@google/adktest imports resolving todist.Manual End-to-End (E2E) Tests:
Not applicable. Both functions are pure string predicates with no I/O. Exercising
gemini-3.5-flash-lite-live-previewend to end needs live model access.tests/e2e/live_model_test.tspinsgemini-3.1-flash-live-preview-04-2026, whose classification this change does not alter.Checklist