Skip to content

Conversation

virendra-dhakhada
Copy link

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:

  1. ContextWindowCompressionConfig was not being set correctly on the Setup event. The context_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 for sliding_window was incorrect (bool instead of dict), so it has been corrected to match the API specification: https://ai.google.dev/api/live#contextwindowcompressionconfig.

  2. Added support for SessionResumptionConfig: https://ai.google.dev/api/live#sessionresumptionconfig.

  3. Added support for handling the GoAway event: https://ai.google.dev/api/live#goaway.

    Currently, the SessionResumptionUpdate and GoAway 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].

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.

1 participant