Skip to content

fix(google): strip Gemini thought summaries - #2039

Merged
toubatbrian merged 2 commits into
mainfrom
timers-catalyst-wrangled
Jul 16, 2026
Merged

fix(google): strip Gemini thought summaries#2039
toubatbrian merged 2 commits into
mainfrom
timers-catalyst-wrangled

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports livekit/agents source change 9dc8f8613 / #6428 to agents-js.

  • Strip Gemini text parts flagged as thought summaries before emitting assistant content.
  • Add mocked Google LLM stream regressions that verify thought text is omitted and thought-only responses retry.
  • Add a patch changeset for @livekit/agents-plugin-google.

Source diff coverage

Coverage classification
  • livekit-plugins/livekit-plugins-google/livekit/plugins/google/llm.py: ported to plugins/google/src/llm.ts; added equivalent filtering for Gemini part.thought text parts in LLMStream.#parsePart. The source retry-loop adjustment is already present in agents-js as chunksYielded only 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 to plugins/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 mocked generateContentStream path. 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 build
  • pnpm --filter @livekit/agents-plugin-google lint (passes with three pre-existing warning-level Google realtime no-explicit-any findings)
  • pnpm test plugins/google (30 passed, 2 skipped)
  • Prettier check and git diff --check
  • API Extractor analysis is not green because this package has no committed API-report baseline; this private parser/test change does not alter exported API.

Cue voice E2E

Verified exact commit e723720d8907501dc7771b30a4a40362022a4923 in fresh Cue voice mode with real Gemini gemini-2.5-flash, thought summaries enabled, LiveKit Inference Deepgram STT, and Cartesia TTS.

  • Session: sid_8786fbd59582
  • Input: Compute 137 times 29. Think carefully before answering.
  • Path evidence: four real Gemini text parts arrived with thought=true and were dropped by plugins/google/src/llm.ts.
  • Persisted assistant content: exactly VISIBLE_ONLY_2039; no thought-summary text reached transcript or TTS.
  • Predicate required the exact assistant output and AS_SPEAKING -> AS_LISTENING, so it waited through playout completion.
  • Result: resolved, exit code 0.
  • Artifacts: persisted 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 ?

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner July 15, 2026 17:57
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e723720

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@livekit/agents-plugin-google Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test Patch

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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
toubatbrian merged commit 4391736 into main Jul 16, 2026
8 checks passed
@toubatbrian
toubatbrian deleted the timers-catalyst-wrangled branch July 16, 2026 02:23
@github-actions github-actions Bot mentioned this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant