From 28fbe1db08f3b0e4ab4dd5256bee1f0e43f6f1cc Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Fri, 27 Mar 2026 17:30:47 -0400 Subject: [PATCH] Don't send history_config for Gemini Live Vertex (unsupported) --- src/pipecat/services/google/gemini_live/llm.py | 14 +++++++++++++- .../services/google/gemini_live/vertex/llm.py | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pipecat/services/google/gemini_live/llm.py b/src/pipecat/services/google/gemini_live/llm.py index 82790c419..7130280b3 100644 --- a/src/pipecat/services/google/gemini_live/llm.py +++ b/src/pipecat/services/google/gemini_live/llm.py @@ -1238,6 +1238,14 @@ class GeminiLiveLLMService(LLMService): self._end_frame_deferral_timeout_task.cancel() self._end_frame_deferral_timeout_task = None + def _get_history_config(self) -> Optional[HistoryConfig]: + """Return the history config for the Live API connection. + + Subclasses can override this to disable history config (e.g. Vertex AI + does not support it). + """ + return HistoryConfig(initial_history_in_client_content=True) + async def _connect(self, session_resumption_handle: Optional[str] = None): """Establish client connection to Gemini Live API.""" if self._session: @@ -1273,9 +1281,13 @@ class GeminiLiveLLMService(LLMService): input_audio_transcription=AudioTranscriptionConfig(), output_audio_transcription=AudioTranscriptionConfig(), session_resumption=SessionResumptionConfig(handle=session_resumption_handle), - history_config=HistoryConfig(initial_history_in_client_content=True), ) + # Add history config, if supported (not supported by Vertex) + history_config = self._get_history_config() + if history_config: + config.history_config = history_config + # Add context window compression to configuration, if enabled cwc = self._settings.context_window_compression or {} if cwc.get("enabled", False): diff --git a/src/pipecat/services/google/gemini_live/vertex/llm.py b/src/pipecat/services/google/gemini_live/vertex/llm.py index cb9d74c62..8466c7f21 100644 --- a/src/pipecat/services/google/gemini_live/vertex/llm.py +++ b/src/pipecat/services/google/gemini_live/vertex/llm.py @@ -212,6 +212,10 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService): **kwargs, ) + def _get_history_config(self): + """Vertex AI does not support history_config.""" + return None + def create_client(self): """Create the Gemini client instance.""" self._client = Client(