Ref: Gemini multimodal live context window compression & session resumption #1974 #2626
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.
Rebased version of [#1974], originally authored by @bo-socayo — all credit to them!
Gemini Multimodal Live Context Window Compression & Session Resumption
This PR addresses the following problems:
ContextWindowCompressionConfig
was not being set correctly on theSetup
event. Thecontext_window_compression
field was missing on the model, so it wasn't being sent to the server—even if the client was configured to set it. Also, the type forsliding_window
was incorrect (bool
instead ofdict
), so it has been corrected to match the API specification: https://ai.google.dev/api/live#contextwindowcompressionconfig.Added support for
SessionResumptionConfig
: https://ai.google.dev/api/live#sessionresumptionconfig.Added support for handling the
GoAway
event: https://ai.google.dev/api/live#goaway.Currently, the
SessionResumptionUpdate
andGoAway
events are simply logged. Implementing actual reconnection behavior is deferred to future work.Example log message for the
SessionResumptionUpdate
event:2025-06-07 04:27:20.357 | DEBUG | pipecat.services.gemini_multimodal_live.gemini:_handle_evt_session_resumption_update:944 - Gemini session resumption update: newHandle='CihvdGNnNThrcHM2eXZlenNiZzFyaTZqbmw4ZHk5dmh2ZnZ3aGRtaWRy' resumable=True lastConsumedClientMessageIndex=None
Partially addresses issue [#1606].