From 1c25b6fb72c079fae5ecfb186516a3ab157dbf0a Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Fri, 10 Oct 2025 12:56:37 -0400 Subject: [PATCH] `location` should not be optional when using Google Vertex. Also, update `GoogleVertexLLMService` initialization pattern in the example file. --- .../foundational/14p-function-calling-gemini-vertex-ai.py | 5 ++--- src/pipecat/services/google/gemini_live/llm_vertex.py | 2 +- src/pipecat/services/google/llm_vertex.py | 4 ++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/foundational/14p-function-calling-gemini-vertex-ai.py b/examples/foundational/14p-function-calling-gemini-vertex-ai.py index f9ad264eb..cba5eee60 100644 --- a/examples/foundational/14p-function-calling-gemini-vertex-ai.py +++ b/examples/foundational/14p-function-calling-gemini-vertex-ai.py @@ -76,9 +76,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = GoogleVertexLLMService( credentials=os.getenv("GOOGLE_VERTEX_TEST_CREDENTIALS"), - params=GoogleVertexLLMService.InputParams( - project_id=os.getenv("GOOGLE_CLOUD_PROJECT_ID"), - ), + project_id=os.getenv("GOOGLE_CLOUD_PROJECT_ID"), + location=os.getenv("GOOGLE_CLOUD_LOCATION"), ) # You can aslo register a function_name of None to get all functions # sent to the same callback with an additional function_name parameter. diff --git a/src/pipecat/services/google/gemini_live/llm_vertex.py b/src/pipecat/services/google/gemini_live/llm_vertex.py index 4f1b57f4c..a38154755 100644 --- a/src/pipecat/services/google/gemini_live/llm_vertex.py +++ b/src/pipecat/services/google/gemini_live/llm_vertex.py @@ -49,7 +49,7 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService): *, credentials: Optional[str] = None, credentials_path: Optional[str] = None, - location: str = "us-east4", + location: str, project_id: str, model="google/gemini-2.0-flash-live-preview-04-09", voice_id: str = "Charon", diff --git a/src/pipecat/services/google/llm_vertex.py b/src/pipecat/services/google/llm_vertex.py index cc0b8654e..49adb2e9b 100644 --- a/src/pipecat/services/google/llm_vertex.py +++ b/src/pipecat/services/google/llm_vertex.py @@ -137,6 +137,10 @@ class GoogleVertexLLMService(OpenAILLMService): if project_id is None: raise ValueError("project_id is required") if location is None: + # If location is not provided, default to "us-east4". + # Note: this is legacy behavior; ideally location would be + # required. + logger.warning("location is not provided. Defaulting to 'us-east4'.") location = "us-east4" # Default location if not provided base_url = self._get_base_url(location, project_id)