Skip to content

fix(go/plugins/anthropic): resolve models using aliases#4703

Merged
hugoaguirre merged 4 commits intomainfrom
haguirre/anthropic_alias
Feb 17, 2026
Merged

fix(go/plugins/anthropic): resolve models using aliases#4703
hugoaguirre merged 4 commits intomainfrom
haguirre/anthropic_alias

Conversation

@hugoaguirre
Copy link
Contributor

@hugoaguirre hugoaguirre commented Feb 16, 2026

Providing a claude model using an alias without the @YYYYMMDD format will resolve into a valid model name

Checklist (if applicable):

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hugoaguirre, 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 enhances the Anthropic plugin by introducing support for model aliases. Previously, users had to specify the exact, date-suffixed model ID (e.g., "claude-3-5-sonnet-20240620"). With this change, users can now use simpler aliases like "claude-3-5-sonnet", and the system will automatically resolve it to the latest available full model ID. This significantly improves the developer experience by making model selection more intuitive and less prone to errors when new model versions are released.

Highlights

  • Model Alias Resolution: Implemented a new resolveModelID function to map user-provided model aliases (e.g., "claude-3-5-sonnet") to their full, date-suffixed model names (e.g., "claude-3-5-sonnet-20241022") by finding the latest version.
  • Flexible Model Instantiation: Modified the newModel function to accept both a user-facing name and an internal apiModelName, allowing the system to use the resolved full model ID when interacting with the Anthropic API.
  • Enhanced ResolveAction: Updated the ResolveAction method to leverage the new resolveModelID function, ensuring that model requests using aliases are correctly translated to the appropriate Anthropic model.
  • Unit Testing: Added comprehensive unit tests for the resolveModelID function to verify its correctness in handling exact matches, aliases, and non-existent model IDs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • go/plugins/anthropic/anthropic.go
    • Imported the strings package.
    • Modified the newModel function signature to accept an additional apiModelName parameter.
    • Updated calls to newModel to pass both the user-provided name and the resolved API model name.
    • Implemented the resolveModelID function to find the best matching model ID from a list of available models, supporting exact matches and prefix-based alias resolution.
    • Integrated resolveModelID into the ResolveAction method to dynamically determine the correct model ID for Anthropic API calls.
  • go/plugins/anthropic/anthropic_test.go
    • Added a new test file.
    • Included TestResolveModelID to validate the functionality of the resolveModelID function with various test cases, including exact matches, aliases, and non-existent models.
Activity
  • No activity (comments, reviews, progress updates) was found in the provided context.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a helpful feature to resolve Anthropic model aliases to their full, versioned names. The implementation is clean, and the new logic is well-tested with the addition of TestResolveModelID. I have one suggestion to improve performance by caching the list of models to avoid repeated API calls. Overall, this is a great enhancement.

@hugoaguirre
Copy link
Contributor Author

/gemini review

@hugoaguirre hugoaguirre marked this pull request as ready for review February 16, 2026 23:20
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to resolve Anthropic model aliases to their full, versioned names, which is a great enhancement for user experience. The implementation includes a caching mechanism for the list of available models to improve performance, which is well-thought-out. The logic for resolving aliases by finding the lexicographically latest model version is sound, and the addition of unit tests for this logic is appreciated. I have one suggestion to further improve the concurrency handling of the model cache to prevent potential performance bottlenecks.

@hugoaguirre hugoaguirre merged commit 4536177 into main Feb 17, 2026
7 checks passed
@hugoaguirre hugoaguirre deleted the haguirre/anthropic_alias branch February 17, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Go] Anthropic: unversioned model names return 404 (e.g. claude-sonnet-4)

2 participants