Merge pull request #2961 from pipecat-ai/pk/gemini-live-fix-session-resumption

Fix Gemini Live session resumption. The problem was that we weren't p…
This commit is contained in:
kompfner
2025-11-04 09:19:17 -05:00
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -19,8 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed `GeminiLiveLLMService` session resumption after a connection timeout.
- `GeminiLiveLLMService` now properly supports context-provided system
instruction and tools
instruction and tools.
## [0.0.92] - 2025-10-31 🎃 "The Haunted Edition" 👻

View File

@@ -1717,13 +1717,17 @@ class GeminiLiveLLMService(LLMService):
self._session_resumption_handle = update.new_handle
async def _handle_send_error(self, error: Exception):
# Ignore "expected" errors that may have occurred for messages that
# were in-flight when a disconnection occurred.
if self._disconnecting or not self._session:
return
# In server-to-server contexts, a WebSocket error should be quite rare.
# Given how hard it is to recover from a send-side error with proper
# state management, and that exponential backoff for retries can have
# cost/stability implications for a service cluster, let's just treat a
# send-side error as fatal.
if not self._disconnecting:
await self.push_error(ErrorFrame(error=f"{self} Send error: {error}", fatal=True))
await self.push_error(ErrorFrame(error=f"{self} Send error: {error}", fatal=True))
def create_context_aggregator(
self,