location should not be optional when using Google Vertex.

Also, update `GoogleVertexLLMService` initialization pattern in the example file.
This commit is contained in:
Paul Kompfner
2025-10-10 12:56:37 -04:00
parent 91b29de7ca
commit 1c25b6fb72
3 changed files with 7 additions and 4 deletions

View File

@@ -76,9 +76,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm = GoogleVertexLLMService( llm = GoogleVertexLLMService(
credentials=os.getenv("GOOGLE_VERTEX_TEST_CREDENTIALS"), 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 # You can aslo register a function_name of None to get all functions
# sent to the same callback with an additional function_name parameter. # sent to the same callback with an additional function_name parameter.

View File

@@ -49,7 +49,7 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService):
*, *,
credentials: Optional[str] = None, credentials: Optional[str] = None,
credentials_path: Optional[str] = None, credentials_path: Optional[str] = None,
location: str = "us-east4", location: str,
project_id: str, project_id: str,
model="google/gemini-2.0-flash-live-preview-04-09", model="google/gemini-2.0-flash-live-preview-04-09",
voice_id: str = "Charon", voice_id: str = "Charon",

View File

@@ -137,6 +137,10 @@ class GoogleVertexLLMService(OpenAILLMService):
if project_id is None: if project_id is None:
raise ValueError("project_id is required") raise ValueError("project_id is required")
if location is None: 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 location = "us-east4" # Default location if not provided
base_url = self._get_base_url(location, project_id) base_url = self._get_base_url(location, project_id)