Repository navigation
feat(models): add Claude Sonnet 4.5 and Opus 4.8 model definitions - #28803
RussellZager wants to merge 20 commits into
Conversation
…rect base URL routing
…atches user skills directory
…ponse tool_result blocks
… system prompt preamble
…d resolution logic
|
📊 PR Size: size/XL
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces support for new Claude models, specifically Claude Sonnet 4.5 and Claude Opus 4.8. The changes include defining these models within the system, updating the model resolution logic to handle their specific version IDs, and ensuring that the default configurations are updated to include these new options. The changes have been validated through the existing test infrastructure to ensure stability and correctness. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements a comprehensive integration of Anthropic Claude models (including Sonnet 5 and Opus 5) into the Gemini CLI, introducing direct Anthropic SDK and Vertex AI Claude routing via AnthropicContentGenerator, along with dual-mode execution launchers, custom fallback policies, and extensive testing harnesses. The review comments correctly identify two critical issues: first, VERTEX_CLAUDE_MODEL_MAP incorrectly maps Claude aliases back to themselves instead of actual Vertex AI publisher model IDs, which will trigger 404 errors on Vertex AI; second, an integration test in claudeModelRouting.test.ts expects AuthType.GATEWAY instead of the newly updated AuthType.USE_GEMINI, which will cause test failures. Both comments are highly actionable and should be addressed.
Note: Security Review did not run due to the size of the PR.
| export const VERTEX_CLAUDE_MODEL_MAP: Record<string, string> = { | ||
| [CLAUDE_SONNET_5_MODEL]: CLAUDE_SONNET_5_MODEL, | ||
| [CLAUDE_OPUS_5_MODEL]: CLAUDE_OPUS_5_MODEL, | ||
| [CLAUDE_SONNET_4_5_MODEL]: CLAUDE_SONNET_4_5_MODEL, | ||
| [CLAUDE_OPUS_4_8_MODEL]: CLAUDE_OPUS_4_8_MODEL, | ||
| 'claude-4-5-sonnet': CLAUDE_SONNET_4_5_MODEL, | ||
| 'claude-4-8-opus': CLAUDE_OPUS_4_8_MODEL, | ||
| 'claude-3-5-sonnet': CLAUDE_SONNET_5_MODEL, | ||
| 'claude-3-7-sonnet': 'claude-3-7-sonnet', | ||
| 'claude-3-opus': 'claude-3-opus', | ||
| }; |
There was a problem hiding this comment.
The VERTEX_CLAUDE_MODEL_MAP currently maps canonical Claude model aliases (like CLAUDE_SONNET_5_MODEL / 'claude-sonnet-5') back to themselves. However, GCP Vertex AI endpoints do not support these generic alias strings directly and will reject them with a ModelNotFoundError (404).
As correctly outlined in the proposal (docs/proposals/cli-launcher-refactoring.md), these aliases must be mapped to the actual Vertex AI publisher model IDs (e.g., 'claude-3-5-sonnet-v2@20241022', 'claude-3-opus@20240229').
| export const VERTEX_CLAUDE_MODEL_MAP: Record<string, string> = { | |
| [CLAUDE_SONNET_5_MODEL]: CLAUDE_SONNET_5_MODEL, | |
| [CLAUDE_OPUS_5_MODEL]: CLAUDE_OPUS_5_MODEL, | |
| [CLAUDE_SONNET_4_5_MODEL]: CLAUDE_SONNET_4_5_MODEL, | |
| [CLAUDE_OPUS_4_8_MODEL]: CLAUDE_OPUS_4_8_MODEL, | |
| 'claude-4-5-sonnet': CLAUDE_SONNET_4_5_MODEL, | |
| 'claude-4-8-opus': CLAUDE_OPUS_4_8_MODEL, | |
| 'claude-3-5-sonnet': CLAUDE_SONNET_5_MODEL, | |
| 'claude-3-7-sonnet': 'claude-3-7-sonnet', | |
| 'claude-3-opus': 'claude-3-opus', | |
| }; | |
| export const VERTEX_CLAUDE_MODEL_MAP: Record<string, string> = { | |
| [CLAUDE_SONNET_5_MODEL]: 'claude-3-5-sonnet-v2@20241022', | |
| [CLAUDE_OPUS_5_MODEL]: 'claude-3-opus@20240229', | |
| [CLAUDE_SONNET_4_5_MODEL]: 'claude-3-5-sonnet-v2@20241022', | |
| [CLAUDE_OPUS_4_8_MODEL]: 'claude-3-opus@20240229', | |
| 'claude-4-5-sonnet': 'claude-3-5-sonnet-v2@20241022', | |
| 'claude-4-8-opus': 'claude-3-opus@20240229', | |
| 'claude-3-5-sonnet': 'claude-3-5-sonnet-v2@20241022', | |
| 'claude-3-7-sonnet': 'claude-3-7-sonnet@20250219', | |
| 'claude-3-opus': 'claude-3-opus@20240229', | |
| }; |
| it('should preserve environment-configured authType without forcing Vertex AI when GOOGLE_GEMINI_BASE_URL is present', () => { | ||
| const originalEnv = { ...process.env }; | ||
| delete process.env['GOOGLE_GENAI_USE_VERTEXAI']; | ||
| process.env['GOOGLE_GEMINI_BASE_URL'] = 'http://127.0.0.1:4000'; | ||
|
|
||
| const authType = getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL); | ||
| expect(authType).toBe(AuthType.GATEWAY); | ||
|
|
||
| process.env = originalEnv; | ||
| }); |
There was a problem hiding this comment.
The integration test asserts that getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL) returns AuthType.GATEWAY. However, in packages/core/src/core/contentGenerator.ts, the environment check for GOOGLE_GEMINI_BASE_URL was updated to return AuthType.USE_GEMINI instead of AuthType.GATEWAY. This mismatch will cause this integration test to fail.
| it('should preserve environment-configured authType without forcing Vertex AI when GOOGLE_GEMINI_BASE_URL is present', () => { | |
| const originalEnv = { ...process.env }; | |
| delete process.env['GOOGLE_GENAI_USE_VERTEXAI']; | |
| process.env['GOOGLE_GEMINI_BASE_URL'] = 'http://127.0.0.1:4000'; | |
| const authType = getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL); | |
| expect(authType).toBe(AuthType.GATEWAY); | |
| process.env = originalEnv; | |
| }); | |
| it('should preserve environment-configured authType without forcing Vertex AI when GOOGLE_GEMINI_BASE_URL is present', () => { | |
| const originalEnv = { ...process.env }; | |
| delete process.env['GOOGLE_GENAI_USE_VERTEXAI']; | |
| process.env['GOOGLE_GEMINI_BASE_URL'] = 'http://127.0.0.1:4000'; | |
| const authType = getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL); | |
| expect(authType).toBe(AuthType.USE_GEMINI); | |
| process.env = originalEnv; | |
| }); |
Summary
claude-sonnet-4-5andclaude-opus-4-8model constants, alias resolution, and policy chain fallbacks.resolveModelmapping to handle explicit version IDs (claude-4-5-sonnet,claude-4-8-opus).DEFAULT_MODEL_CONFIGSwith display names and descriptions.Test Plan
npm run test:claude(16 passing tests)npm run typecheck(zero TypeScript errors)