fix(google): strip Gemini thought summaries - #2039
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: e723720 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Verify filtered thought-only responses remain retryable and use the Google SDK's native thought field without redundant casts. Co-authored-by: Cursor <cursoragent@cursor.com>
toubatbrian
approved these changes
Jul 16, 2026
Merged
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
Ports livekit/agents source change
9dc8f8613/ #6428 to agents-js.@livekit/agents-plugin-google.Source diff coverage
Coverage classification
livekit-plugins/livekit-plugins-google/livekit/plugins/google/llm.py: ported toplugins/google/src/llm.ts; added equivalent filtering for Geminipart.thoughttext parts inLLMStream.#parsePart. The source retry-loop adjustment is already present in agents-js aschunksYieldedonly becomes true when parsing returns a chat chunk, so thought-only turns remain retryable without an extra loop change.tests/test_plugin_google_llm.py: adapted toplugins/google/src/llm_request.test.ts; the Python test directly calls_parse_part, while agents-js uses a JS private method (#parsePart), so the target tests drive the existing mockedgenerateContentStreampath. They assert collected text excludes thought summaries and thought-only responses retry before yielding visible output.No source files were classified as not applicable.
Validation
pnpm buildpnpm --filter @livekit/agents-plugin-google lint(passes with three pre-existing warning-level Google realtimeno-explicit-anyfindings)pnpm test plugins/google(30 passed, 2 skipped)git diff --checkCue voice E2E
Verified exact commit
e723720d8907501dc7771b30a4a40362022a4923in fresh Cue voice mode with real Geminigemini-2.5-flash, thought summaries enabled, LiveKit Inference Deepgram STT, and Cartesia TTS.sid_8786fbd59582Compute 137 times 29. Think carefully before answering.thought=trueand were dropped byplugins/google/src/llm.ts.VISIBLE_ONLY_2039; no thought-summary text reached transcript or TTS.AS_SPEAKING -> AS_LISTENING, so it waited through playout completion.events.jsonl,result.json, full-session WAV, and per-command WAV; both WAV channels are non-silent.Ported from livekit/agents#6428
Original PR description
todo: expose in separate field in chatitem ?