From 744aa0cd2ab1c6880ec07f4bfc0a8bddbe2d0e4f Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Fri, 9 Oct 2026 15:43:04 -0500 Subject: [PATCH] refactor(ai): default Vertex location to global in shared helper (#54171) --- packages/ai/src/providers/google-vertex-chat.ts | 2 +- packages/ai/src/providers/google-vertex-messages.ts | 2 +- packages/ai/src/providers/google-vertex-mistral.ts | 3 +-- packages/ai/src/providers/google-vertex-responses.ts | 2 +- packages/ai/src/providers/google-vertex-shared.ts | 4 ++-- packages/ai/src/providers/google-vertex.ts | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/ai/src/providers/google-vertex-chat.ts b/packages/ai/src/providers/google-vertex-chat.ts index 8a44ed6c8cb..d9126732752 100644 --- a/packages/ai/src/providers/google-vertex-chat.ts +++ b/packages/ai/src/providers/google-vertex-chat.ts @@ -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, diff --git a/packages/ai/src/providers/google-vertex-messages.ts b/packages/ai/src/providers/google-vertex-messages.ts index 7e078a11800..56a0106fe86 100644 --- a/packages/ai/src/providers/google-vertex-messages.ts +++ b/packages/ai/src/providers/google-vertex-messages.ts @@ -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, diff --git a/packages/ai/src/providers/google-vertex-mistral.ts b/packages/ai/src/providers/google-vertex-mistral.ts index 2c9a9808090..7bca01e54e4 100644 --- a/packages/ai/src/providers/google-vertex-mistral.ts +++ b/packages/ai/src/providers/google-vertex-mistral.ts @@ -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, diff --git a/packages/ai/src/providers/google-vertex-responses.ts b/packages/ai/src/providers/google-vertex-responses.ts index 6fb69c7651e..fcac5e15a4f 100644 --- a/packages/ai/src/providers/google-vertex-responses.ts +++ b/packages/ai/src/providers/google-vertex-responses.ts @@ -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, diff --git a/packages/ai/src/providers/google-vertex-shared.ts b/packages/ai/src/providers/google-vertex-shared.ts index 76fa753965c..8c2bf89759f 100644 --- a/packages/ai/src/providers/google-vertex-shared.ts +++ b/packages/ai/src/providers/google-vertex-shared.ts @@ -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" diff --git a/packages/ai/src/providers/google-vertex.ts b/packages/ai/src/providers/google-vertex.ts index 4f5ad1ceee2..e5d5d53518d 100644 --- a/packages/ai/src/providers/google-vertex.ts +++ b/packages/ai/src/providers/google-vertex.ts @@ -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 ??