refactor(ai): default Vertex location to global in shared helper (#54171)

This commit is contained in:
Aiden Cline
2026-10-09 15:43:04 -05:00
committed by GitHub
Unverified
parent d2905b8dda
commit 744aa0cd2a
6 changed files with 7 additions and 8 deletions
@@ -47,7 +47,7 @@ const configuredRoute = (input: Config) => {
project: inputProject,
...rest
} = input
const location = GoogleVertexShared.location(inputLocation, "global")
const location = GoogleVertexShared.location(inputLocation)
const project = GoogleVertexShared.project(inputProject)
return route.with({
...rest,
@@ -77,7 +77,7 @@ const configuredRoute = (input: Config) => {
project: inputProject,
...rest
} = input
const location = GoogleVertexShared.location(inputLocation, "global")
const location = GoogleVertexShared.location(inputLocation)
const project = GoogleVertexShared.project(inputProject)
return route.with({
...rest,
@@ -63,8 +63,7 @@ const configuredRoute = (input: Config) => {
project: inputProject,
...rest
} = input
// Mistral is served from regional endpoints only; the global endpoint returns 404.
const location = GoogleVertexShared.location(inputLocation, "us-central1")
const location = GoogleVertexShared.location(inputLocation)
const project = GoogleVertexShared.project(inputProject)
return route.with({
...rest,
@@ -48,7 +48,7 @@ const configuredRoute = (input: Config) => {
project: inputProject,
...rest
} = input
const location = GoogleVertexShared.location(inputLocation, "global")
const location = GoogleVertexShared.location(inputLocation)
const project = GoogleVertexShared.project(inputProject)
return route.with({
...rest,
@@ -21,12 +21,12 @@ export const project = (value?: string) =>
process.env.GCP_PROJECT ??
process.env.GCLOUD_PROJECT
export const location = (value: string | undefined, fallback: string) =>
export const location = (value: string | undefined) =>
value ??
process.env.GOOGLE_VERTEX_LOCATION ??
process.env.GOOGLE_CLOUD_LOCATION ??
process.env.VERTEX_LOCATION ??
fallback
"global"
export const host = (location: string) => {
if (location === "global") return "aiplatform.googleapis.com"
+1 -1
View File
@@ -91,7 +91,7 @@ const configuredRoute = (input: Config, modelID: string | ModelID) => {
provider: id,
message: "Google Vertex tuned models do not support Express Mode API keys",
})
const location = GoogleVertexShared.location(inputLocation, "global")
const location = GoogleVertexShared.location(inputLocation)
const project = GoogleVertexShared.project(inputProject)
const endpoint =
baseURL ??