Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 15, 2025

Fixes #5751

Summary

This PR adds support for custom model input in the Vertex AI provider settings, allowing users to specify custom model IDs in the correct Vertex format (e.g., claude-sonnet-4@20250514) to avoid 404 errors.

Changes Made

UI Changes

  • Vertex Provider Settings: Added a custom model input field with placeholder text showing the correct format
  • Internationalization: Added translation keys for custom model UI elements

Backend Changes

  • Provider Settings Schema: Extended vertexSchema to include optional vertexCustomModelId field
  • Model Selection Logic: Updated useSelectedModel hook to prioritize custom models when provided
  • AnthropicVertexHandler: Enhanced to handle custom model names with proper thinking suffix support

Testing

  • Comprehensive Test Coverage: Added 25 tests for AnthropicVertexHandler custom model functionality
  • Frontend Hook Tests: Added 8 tests for useSelectedModel hook with React Query mocking
  • All tests passing: Both custom functionality and existing functionality verified

Technical Details

Model Format Handling

  • Supports Vertex AI model format with @ separator (e.g., claude-sonnet-4@20250514)
  • Automatically handles thinking models with :thinking suffix
  • Maintains backward compatibility with predefined models

Validation

  • Input field trims whitespace automatically
  • Falls back to predefined models when custom model is empty
  • Preserves existing model selection behavior for other providers

Testing Results

✅ AnthropicVertexHandler tests: 25/25 passing
✅ useSelectedModel hook tests: 8/8 passing
✅ All linting and type checking passed

User Experience

Users can now:

  1. Navigate to Settings → Providers → Vertex AI
  2. Enter a custom model ID in the "Custom Model" field
  3. Use the correct Vertex format (e.g., claude-sonnet-4@20250514)
  4. Avoid 404 errors when using newer or custom Vertex AI models

This resolves the core issue where users were getting 404 errors due to model name format mismatches between the UI suggestions and Vertex AI requirements.


Important

Adds custom model support for Vertex AI provider, allowing users to specify custom model IDs, with updates to UI, backend logic, and comprehensive testing.

  • Behavior:
    • Adds custom model input support in Vertex AI provider settings, allowing custom model IDs like claude-sonnet-4@20250514.
    • Updates useSelectedModel hook to prioritize custom models.
    • Enhances AnthropicVertexHandler to handle custom model names with thinking suffix.
  • Schema and Logic:
    • Extends vertexSchema in provider-settings.ts to include vertexCustomModelId.
    • Updates getSelectedModel in useSelectedModel.ts to handle custom models.
  • UI:
    • Adds custom model input field in Vertex.tsx with placeholder and description.
    • Adds translation keys for custom model UI elements in settings.json.
  • Testing:
    • Adds 25 tests for AnthropicVertexHandler custom model functionality in anthropic-vertex.spec.ts.
    • Adds 8 tests for useSelectedModel hook in useSelectedModel.spec.tsx.
    • All tests passing, ensuring both custom and existing functionality work correctly.

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

- Add custom model input field to Vertex provider settings UI
- Update provider settings schema to include vertexCustomModelId field
- Modify useSelectedModel hook to prioritize custom models for Vertex
- Update AnthropicVertexHandler to handle custom model names with thinking suffix support
- Add comprehensive tests for custom model functionality
- Add i18n translations for custom model UI elements

Fixes #5751: Users can now input custom Vertex AI model IDs in the correct @ format (e.g., claude-sonnet-4@20250514) to avoid 404 errors
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 15, 2025 17:45
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 15, 2025
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Jul 15, 2025
// For custom models, use default model info as fallback
const defaultInfo = vertexModels[vertexDefaultModelId]
return {
id: customModelId.trim(),
Copy link
Contributor

Choose a reason for hiding this comment

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

The custom model handling here simply trims and returns the custom ID using fallback info, but it doesn’t strip a ':thinking' suffix as done in AnthropicVertexHandler.getModel. For consistency in UI display (and to avoid potential confusion), consider mirroring that logic.

Suggested change
id: customModelId.trim(),
id: customModelId.trim().replace(/:thinking$/, ""),

<VSCodeTextField
value={apiConfiguration?.vertexCustomModelId || ""}
onInput={handleInputChange("vertexCustomModelId")}
placeholder="claude-sonnet-4@20250514"
Copy link
Contributor

Choose a reason for hiding this comment

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

The new custom model text field looks well-integrated with proper translation keys and placeholder text. If possible, consider externalizing the placeholder example ('claude-sonnet-4@20250514') into a translation key for consistency with internationalization practices.

Suggested change
placeholder="claude-sonnet-4@20250514"
placeholder={t("settings:placeholders.customModelExample")}

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

@daniel-lxs daniel-lxs moved this from Triage to Roomote/renovate BOT in Roo Code Roadmap Jul 15, 2025
@daniel-lxs daniel-lxs closed this Sep 16, 2025
@github-project-automation github-project-automation bot moved this from Renovate BOT to Done in Roo Code Roadmap Sep 16, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 16, 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 Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:XL This PR changes 500-999 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Claude Code using Vertex fails on model selection

4 participants