Port to the websockets asyncio implementation, support for websockets 13 and 14

This commit is contained in:
Mark Backman
2025-07-22 17:23:55 -04:00
parent 7955080da2
commit 300f19ad23
19 changed files with 94 additions and 68 deletions

View File

@@ -75,7 +75,7 @@ from . import events
from .file_api import GeminiFileAPI
try:
import websockets
from websockets.asyncio.client import connect as websocket_connect
except ModuleNotFoundError as e:
logger.error(f"Exception: {e}")
logger.error("In order to use Google AI, you need to `pip install pipecat-ai[google]`.")
@@ -791,7 +791,7 @@ class GeminiMultimodalLiveLLMService(LLMService):
try:
logger.info(f"Connecting to wss://{self._base_url}")
uri = f"wss://{self._base_url}?key={self._api_key}"
self._websocket = await websockets.connect(uri=uri)
self._websocket = await websocket_connect(uri=uri)
self._receive_task = self.create_task(self._receive_task_handler())
# Create the basic configuration