Repository navigation
Conversation
Merge standalone Live usage into compatible model events during evaluation conversion, retaining unmatched reports without mutating session events. Fixes google#7321
Keep input and output transcription events tied to their Live connection so normalized user audio does not appear to start another model request.
Reconstruct request boundaries before event conversion drops completion and connection metadata. Persist the optional count so saved eval sets retain it, while old files and unary invocations keep event-based fallback. Fixes google#7351
This was referenced Oct 6, 2026
yang0228
marked this pull request as ready for review
October 7, 2026 06:35
Replace the implementation-specific tag with a TODO describing the existing quadratic scan and indexing boundary. No counting or usage behavior changes.
Pin the client-message boundary during an unfinished generation at two calls. Verify one, two and three audio chunks stay at one inference with or without standalone usage, preserving audio and token totals. Refs google#7351
Keep both the Live usage regressions and the upstream model/tool duration test. The PR still changes only the evaluation converter and its existing test module. NO_UNIT_GUIDE=Merge-only sync; flagged modules are unchanged upstream additions, and this PR introduces no Python modules.
Keep the Live request-count regressions alongside the upstream model/tool duration test. Sync the reviewed usage prerequisite without rewriting published history. NO_UNIT_GUIDE=Merge-only sync; flagged modules are unchanged upstream additions and this PR introduces no Python modules.
Merge main 8f17ac4 without conflicts after syncing the usage prerequisite. Keep the PR diff limited to the existing seven files.
Merge upstream main 1cb926d after the prerequisite google#7323 landed via Copybara. Keep its standalone-usage matching and all upstream regressions, track surviving source events for logical Live counts, and adapt the receiver test helper to the current Live module. Refs google#7351 NO_UNIT_GUIDE=Merge imports already-published upstream modules; this PR adds no source modules.
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.
Problem and resulting behavior
Closes #7351. One Gemini Live generation should count as one inference, regardless of text/audio chunking, thought-to-answer transitions, or text flushed before a tool call. A tool call followed by its response and another model answer counts as two; an interrupted generation followed by a new generation also counts as two. The evaluation owner confirmed these semantics in the issue discussion.
The original reproducer gives 1 / 2 / 3 for identical answers split into 1 / 2 / 3 chunks on current main. This PR gives 1 / 1 / 1, while retaining separate genuine requests and token usage.
Implementation and upstream integration
model_version, so histories that omit partial chunks still count.Nonecounts; respect an explicit zero.1cb926d5inab9eb64f, preserving published history. The landed usage-matching algorithm is retained; counting tracks only the surviving source events. Tests now call the current Live receiver module. The remaining diff is seven files, with no newly added source modules.All upstream and PR regression tests were retained. Coverage includes typed client messages, 1/2/3 text and audio chunks, thought/answer and text/tool transitions, interruption/barge-in, separate authors/connections, late or standalone usage, empty/non-text content, and saved-JSON fallback/round trips.
Saved eval JSON: owner decision still requested
The optional
Invocation.inference_call_countfield preserves a count that cannot be recovered reliably after raw event boundaries are removed. New readers accept older eval JSON with the field absent. Newly saved JSON containing this field is rejected by older strict readers (extra="forbid"). Please confirm whether this saved-schema compatibility boundary is acceptable; it has not been treated as approved.Fresh validation on ab9eb64 — 2026-11-08
A new Python 3.12.13 environment was provisioned under current main's
constraints-3.12.txt:google-genai==2.30.0, Agent Platform/AI Platform2.3.0. Dependency compatibility checks passed.live/test directory.site-packages.1cb926d5gives1/2/3and fails; this PR gives1/1/1and passes.NO_UNIT_GUIDEreason for modules imported by the upstream merge; this PR adds no source modules. The reason is recorded in the merge commit.These are focused validation results using deterministic local transport with real ADK components. The full unit suite, other Python versions, and remote Gemini E2E/billing behavior were not revalidated in this refresh. Remote CI still needs maintainer approval.
Checklist