Skip to content

Conversation

@VisargD
Copy link
Collaborator

@VisargD VisargD commented Jun 25, 2025

Description

Motivation

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Screenshots (if applicable)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

Closes #1172

@matter-code-review
Copy link
Contributor

Code Quality new feature

Summary By MatterAI MatterAI logo

🔄 What Changed

  • Added support for Vertex AI global region endpoints
  • Implemented a new condition to handle 'global' region in the API URL generation
  • When vertexRegion is set to 'global', the API will use 'https://aiplatform.googleapis.com' as the base URL

🔍 Impact of the Change

This change allows users to connect to Vertex AI's global region endpoints, expanding the service's compatibility with Google's AI platform infrastructure. The global endpoint can be used for certain Vertex AI services that are not region-specific.

📁 Total Files Changed

  • 1 file modified (src/providers/google-vertex-ai/api.ts)
  • 3 lines added, 0 lines deleted

🧪 Test Added

N/A - No tests were included in this PR

🔒Security Vulnerabilities

N/A - No security vulnerabilities detected

Motivation

To support Google Vertex AI's global region endpoints, allowing users to access services that are available through the global API endpoint.

Type of Change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Screenshots (if applicable)

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

N/A

Tip

Quality Recommendations

  1. Add a comment explaining why the global region is handled differently

  2. Consider adding a unit test for the new global region endpoint

Sequence Diagram

sequenceDiagram
    participant Client
    participant VertexAIProvider
    participant API
    participant GoogleVertexAI

    Client->>VertexAIProvider: Request with vertexRegion='global'
    VertexAIProvider->>API: getBaseUrl(vertexRegion)
    Note over API: New condition added for global region
    alt vertexRegion === 'global'
        API-->>VertexAIProvider: https://aiplatform.googleapis.com
    else vertexRegion is specific region
        API-->>VertexAIProvider: https://{vertexRegion}-aiplatform.googleapis.com
    end
    VertexAIProvider->>GoogleVertexAI: API request with correct endpoint
    GoogleVertexAI-->>VertexAIProvider: Response
    VertexAIProvider-->>Client: Processed response
Loading

Copy link
Contributor

@matter-code-review matter-code-review bot left a comment

Choose a reason for hiding this comment

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

This PR adds support for Vertex AI global region endpoints, which is a valuable addition. The implementation is clean and straightforward. I have one suggestion to improve code documentation.

@VisargD VisargD merged commit 56fc835 into main Jun 25, 2025
2 checks passed
}

if (vertexRegion === 'global') {
return `https://aiplatform.googleapis.com`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

just adding as a note, I've just tested this endpoint with normal regions like us-east5 as well and it works, so I think we can make this as the default instead of ln:63

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Based on their docs, it only works for some models. So partner models like anthropic and meta models might not work if we change the url.
https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#supported_models

@VisargD VisargD deleted the feat/vertex-global-region-support branch June 25, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertex global region endpoints

4 participants