feat(go/plugins/anthropic): register latest Claude models#5519
Conversation
….7/…) for Go↔JS parity
There was a problem hiding this comment.
Code Review
This pull request centralizes the configuration of Claude model capabilities by introducing a shared modelOptions helper, mirroring the JS plugin's KNOWN_MODELS. It maps curated models to advanced capabilities (such as JSON output support) and integrates this helper into both ListActions and ResolveAction. Additionally, new tests and sample flows have been added to verify and demonstrate these capabilities. The review feedback points out an issue where versioned model IDs containing a date suffix (e.g., -YYYYMMDD) will fail the lookup in knownModels and fall back to default options, thereby losing their curated capabilities. A code suggestion is provided to strip this suffix before performing the lookup.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| func modelOptions(name string) ai.ModelOptions { | ||
| opts, ok := knownModels[name] | ||
| if !ok { | ||
| opts = defaultClaudeOpts | ||
| } | ||
| if opts.Label == "" { | ||
| opts.Label = fmt.Sprintf("%s - %s", anthropicLabelPrefix, name) | ||
| } | ||
| return opts | ||
| } |
There was a problem hiding this comment.
When a user requests a model using its fully-qualified versioned ID (e.g., claude-opus-4-5-20251101), modelOptions looks up the full versioned ID in knownModels. Since knownModels only contains the unversioned aliases (e.g., claude-opus-4-5), the lookup fails and falls back to defaultClaudeOpts. This means versioned model IDs will not receive their curated capabilities (such as JSON output support).
To fix this, we should strip the 8-digit date suffix (e.g., -YYYYMMDD) from the model name before looking it up in knownModels.
func modelOptions(name string) ai.ModelOptions {
baseName := name
if len(name) >= 9 && name[len(name)-9] == '-' {
isDate := true
for i := len(name) - 8; i < len(name); i++ {
if name[i] < '0' || name[i] > '9' {
isDate = false
break
}
}
if isDate {
baseName = name[:len(name)-9]
}
}
opts, ok := knownModels[baseName]
if !ok {
opts = defaultClaudeOpts
}
if opts.Label == "" {
opts.Label = fmt.Sprintf("%s - %s", anthropicLabelPrefix, name)
}
return opts
}
This PR registers latest Claude models (opus 4.8/4.7/…) for Go↔JS parity.
Closes: #5494
Checklist (if applicable):