Skip to content

Fix Gemini Live to handle bundled server_content fields#4147

Merged
kompfner merged 5 commits intomainfrom
cb/gemini-transcript-fixes
Mar 27, 2026
Merged

Fix Gemini Live to handle bundled server_content fields#4147
kompfner merged 5 commits intomainfrom
cb/gemini-transcript-fixes

Conversation

@chadbailey59
Copy link
Copy Markdown
Contributor

Summary

  • Gemini 3.x can bundle multiple fields (e.g. model_turn and output_transcription) on the same server_content message
  • The previous elif chain only processed the first matching field, silently dropping the rest
  • Switched to independent if checks so every field on a message is handled

Test plan

  • Test with Gemini Live using transcription enabled to verify both model audio and output transcription are processed from bundled messages
  • Verify interruption handling still works correctly
  • Confirm tool calls and session resumption updates are unaffected

🤖 Generated with Claude Code

Gemini 3.x can bundle multiple fields (e.g. model_turn and
output_transcription) on the same server_content message. The previous
elif chain would only process the first matching field and silently
drop the rest. Switch to independent if checks so every field is
handled.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pipecat/services/google/gemini_live/llm.py 0.00% 11 Missing ⚠️
Files with missing lines Coverage Δ
src/pipecat/services/google/gemini_live/llm.py 26.24% <0.00%> (-0.33%) ⬇️

... and 34 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

self._check_and_reset_failure_counter()

if message.server_content and message.server_content.interrupted:
# server_content fields are NOT mutually exclusive —
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.

Haven't dug too deep into this yet, but if this is broadly the case I'd be a bit surprised if the fix were as simple as just changing elif to if (in other words, I'd expect that there'd be some subtle implicit assumptions in our message handling logic about messages being mutually exclusive).

Do we know which server_content fields are allowed together? If it's only model_turn and output_transcription maybe we can be a bit more targeted in our change.

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.

I'd expect that there'd be some subtle implicit assumptions in our message handling logic about messages being mutually exclusive)

Indeed: #4148

…es-addon

Fix bundled Gemini Live transcription ordering
Comment thread tests/test_google_gemini_live_llm.py Outdated
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.

these tests feel a little too "reach-into-internals-y". pretty much any internal refactoring or name changes will break these.

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.

I agree. I told @chadbailey59 that I thought we should just cherry-pick the actual fix and not include the test. (I just let Codex write the test it wanted to write, and then committed that change. But I shouldn't have committed the test.) But I think I told Chad that in a DM so it got lost in the shuffle. Apologies.

@kompfner
Copy link
Copy Markdown
Contributor

Waiting to test/validate this once we can (once our usage of history_config is unblocked)

Copy link
Copy Markdown
Contributor

@kompfner kompfner left a comment

Choose a reason for hiding this comment

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

Waiting to test/validate this once we can (once our usage of history_config is unblocked)

Gemini 3.1 Flash Live is working for basic conversation-and-tool-call usage (26, 26b, 26e, 26g). We'll continue to iron out the kinks in the others.

@kompfner kompfner merged commit 9e350bc into main Mar 27, 2026
5 checks passed
@kompfner kompfner deleted the cb/gemini-transcript-fixes branch March 27, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants