fix(vertex_llm_base.py): handle default vertex location

This commit is contained in:
Krrish Dholakia 2025-05-28 11:33:39 -07:00
parent 18f7316b08
commit cc780ecf5a

View file

@ -135,15 +135,20 @@ class VertexBase:
return google_auth.default(scopes=scopes)
def get_default_vertex_location(self) -> str:
return "us-central1"
def get_api_base(
self, api_base: Optional[str], vertex_location: Optional[str]
) -> str:
if api_base:
return api_base
elif vertex_location and vertex_location == "global":
elif vertex_location == "global":
return "https://aiplatform.googleapis.com"
else:
elif vertex_location:
return f"https://{vertex_location}-aiplatform.googleapis.com"
else:
return f"https://{self.get_default_vertex_location()}-aiplatform.googleapis.com"
def refresh_auth(self, credentials: Any) -> None:
from google.auth.transport.requests import (