Skip to content

.Net: Fix VertexAI global endpoint URI construction (#13620) - #13621

Merged
rogerbarreto merged 2 commits into
microsoft:mainfrom
schmitch:schmitch/fixed-global-endpoint
May 1, 2026
Merged

.Net: Fix VertexAI global endpoint URI construction (#13620)#13621
rogerbarreto merged 2 commits into
microsoft:mainfrom
schmitch:schmitch/fixed-global-endpoint

Conversation

@schmitch

@schmitch schmitch commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

The global VertexAI location uses https://aiplatform.googleapis.com rather than the regional https://{location}-aiplatform.googleapis.com pattern. This adds a GetVertexAIBaseUri helper to ClientBase that selects the correct base URI and updates all VertexAI clients (chat completion, token counter, embeddings) to use it.

The global VertexAI location uses `https://aiplatform.googleapis.com`
rather than the regional `https://{location}-aiplatform.googleapis.com`
pattern. This adds a `GetVertexAIBaseUri` helper to ClientBase that
selects the correct base URI and updates all VertexAI clients
(chat completion, token counter, embeddings) to use it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@schmitch
schmitch requested a review from a team as a code owner March 2, 2026 11:22
@moonbox3 moonbox3 added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Mar 2, 2026
@noah-rss

Copy link
Copy Markdown

Any idea on when this PR will be reviewed? We have run into this bug in production as well and it removes our ability to use preview models without a janky workaround.

Thanks Schmitt and to the Microsoft team for handling this!

Copilot AI review requested due to automatic review settings April 30, 2026 13:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the .NET Google connectors’ Vertex AI endpoint construction so that location=global correctly targets the global Vertex AI host (https://aiplatform.googleapis.com) instead of the regional host pattern (https://{location}-aiplatform.googleapis.com), and adds tests to prevent regressions.

Changes:

  • Added a ClientBase.GetVertexAIBaseUri(location) helper to select the correct Vertex AI host for global vs regional locations.
  • Updated Vertex AI-backed clients (embeddings, Gemini chat, Gemini token counting) to build request URIs using the new helper.
  • Added unit tests to verify global and regional host selection and to treat "global" as an accepted location segment.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dotnet/src/Connectors/Connectors.Google/Core/VertexAI/VertexAIEmbeddingClient.cs Uses GetVertexAIBaseUri(location) when constructing the embeddings endpoint URI.
dotnet/src/Connectors/Connectors.Google/Core/Gemini/Clients/GeminiTokenCounterClient.cs Uses GetVertexAIBaseUri(location) when constructing the Vertex AI token counting endpoint URI.
dotnet/src/Connectors/Connectors.Google/Core/Gemini/Clients/GeminiChatCompletionClient.cs Uses GetVertexAIBaseUri(location) when constructing Vertex AI chat generation/streaming endpoint URIs.
dotnet/src/Connectors/Connectors.Google/Core/ClientBase.cs Introduces GetVertexAIBaseUri helper with global vs regional host selection.
dotnet/src/Connectors/Connectors.Google.UnitTests/Core/VertexAI/VertexAIClientEmbeddingsGenerationTests.cs Adds coverage ensuring global vs regional endpoints are selected correctly for embeddings.
dotnet/src/Connectors/Connectors.Google.UnitTests/Core/Gemini/Clients/GeminiCountingTokensTests.cs Adds coverage ensuring global vs regional endpoints are selected correctly for token counting.
dotnet/src/Connectors/Connectors.Google.UnitTests/Core/Gemini/Clients/GeminiChatGenerationTests.cs Adds coverage ensuring global vs regional endpoints are selected correctly for chat generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rogerbarreto
rogerbarreto enabled auto-merge April 30, 2026 21:19
@rogerbarreto
rogerbarreto added this pull request to the merge queue Apr 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 30, 2026
@rogerbarreto
rogerbarreto added this pull request to the merge queue May 1, 2026
Merged via the queue into microsoft:main with commit 6e1ab9d May 1, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from Community PR to Done in Agent Framework May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants