Skip to content

Conversation

@jferrell-sayari
Copy link

@jferrell-sayari jferrell-sayari commented Jun 18, 2025

Related GitHub Issue

Closes: #3114

Description

This PR adds a "Use custom base URL" option to the Vertex AI provider just like the Google Gemini provider has. This will allow us to run requests to Vertex AI through a proxy. @shwuhk mentioned needing this feature in the linked issue as well to help solve an issue they're experiencing.

Test Procedure

Unit tests were added and manual testing was performed for:

  1. Use of both Google Gemini and Vertex AI continue to work without this setting checked
  2. Specifying a custom base URL in only Google Gemini or Vertex AI does not affect the other.
  3. Configuration changes are saved properly
  4. UI displays correctly

Type of Change

  • 🐛 Bug Fix: Non-breaking change that fixes an issue.
  • New Feature: Non-breaking change that adds functionality.
  • 💥 Breaking Change: Fix or feature that would cause existing functionality to not work as expected.
  • ♻️ Refactor: Code change that neither fixes a bug nor adds a feature.
  • 💅 Style: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
  • 📚 Documentation: Updates to documentation files.
  • ⚙️ Build/CI: Changes to the build process or CI configuration.
  • 🧹 Chore: Other changes that don't modify src or test files.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Code Quality:
    • My code adheres to the project's style guidelines.
    • There are no new linting errors or warnings (npm run lint).
    • All debug code (e.g., console.log) has been removed.
  • Testing:
    • New and/or updated tests have been added to cover my changes.
    • All tests pass locally (npm test).
    • The application builds successfully with my changes.
  • Branch Hygiene: My branch is up-to-date (rebased) with the main branch.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • [] Changeset: A changeset has been created using npm run changeset if this PR includes user-facing changes or dependency updates.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Screenshot 2025-06-18 at 2 20 40 AM

Documentation Updates

The documentation should be updated to mention this capability. However, I noticed the documentation does not mention that the Google Gemini provider has this capability.

Additional Notes

Get in Touch

jferrell_sayari


Important

Adds custom base URL option for Vertex AI provider, updates handlers and UI, and includes tests and i18n updates.

  • Behavior:
    • Adds vertexBaseUrl option to Vertex AI provider in provider-settings.ts.
    • Updates VertexHandler in vertex.ts to use vertexBaseUrl for HTTP requests.
    • UI updated in Vertex.tsx to include checkbox and input for custom base URL.
  • Testing:
    • Adds unit tests in vertex.spec.ts to verify vertexBaseUrl usage in createMessage and completePrompt.
  • Misc:
    • Updates i18n files for multiple languages to include default vertexUrl.

This description was created by Ellipsis for 5d774da. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jun 18, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 18, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 18, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 18, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Hey @jferrell-sayari, thanks for the PR!

I left a couple of questions and suggestions worth taking a look at.
Curious to hear your thoughts!

const geminiSchema = apiModelIdProviderModelSchema.extend({
geminiApiKey: z.string().optional(),
googleGeminiBaseUrl: z.string().optional(),
isVertex: z.boolean().optional(),
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about adding isVertex to the geminiSchema here. From what I can see, this appears to be an internal implementation detail that's used to differentiate behavior when VertexHandler extends GeminiHandler.

Would this show up in the Gemini provider settings UI? It seems like users choose either Gemini OR Vertex as their provider, not both, so having an isVertex toggle in Gemini settings might be confusing.

Could we keep this as an internal flag that's only passed by the VertexHandler constructor instead of exposing it in the schema?

"lmStudioUrl": "Default: http://localhost:1234",
"geminiUrl": "Default: https://generativelanguage.googleapis.com"
"geminiUrl": "Default: https://generativelanguage.googleapis.com",
"vertexUrl": "Default: http://localhost:1234"
Copy link
Member

Choose a reason for hiding this comment

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

I noticed the default URL for Vertex is set to http://localhost:1234. Is this intentional?

It seems like this might be a copy from the LM Studio default. For Vertex AI, wouldn't users typically use Google Cloud endpoints like https://{region}-aiplatform.googleapis.com or a custom proxy URL?

Maybe we could use a more representative placeholder that helps users understand what kind of URL to enter?

const config: GenerateContentConfig = {
systemInstruction,
httpOptions: this.options.googleGeminiBaseUrl ? { baseUrl: this.options.googleGeminiBaseUrl } : undefined,
httpOptions: this.options.isVertex
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit unsure about the logic here. We're checking isVertex in GeminiHandler to choose between vertexBaseUrl and googleGeminiBaseUrl.

This works because VertexHandler extends GeminiHandler and sets isVertex: true, but it feels like a layering violation - GeminiHandler is now aware of Vertex-specific config.

It might be cleaner to let the Vertex provider handle its own configuration and keep the Gemini provider focused only on its own settings.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 19, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 22, 2025
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Changes Requested size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug Report] Google Vertex AI integration fails with 404 Not Found after updating to v3.15.1

3 participants