-
-
Notifications
You must be signed in to change notification settings - Fork 40
v6.6.71 #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v6.6.71 #75
Conversation
…del info generation
feat(gemini): add per-key model alias support for Gemini provider
refactor(executor): resolve upstream model at conductor level before execution
feat(watcher): add model mappings change detection
Summary of ChangesHello @luispater, 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 significantly refactors the model resolution and configuration management within the system. The primary goal is to provide more explicit control over how models are aliased and routed to their upstream providers, particularly for Gemini, Claude, and Codex. By introducing dedicated configuration sections for model mappings and updating the underlying executor logic, the changes ensure that the correct upstream model is consistently identified and used, while also improving the system's ability to detect and react to configuration changes. This leads to a more robust and configurable model handling pipeline. Highlights
🧠 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. 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 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 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
|
There was a problem hiding this 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 significant feature for model aliasing for API key-based providers, along with a substantial refactoring of model name resolution across various executors. The changes enhance configuration flexibility and improve code maintainability by reducing duplication, notably through the introduction of a generic function for building model configurations. My review focuses on ensuring the new logic is applied consistently and identifying opportunities for performance improvements. I've found a potential issue in openai_compat_executor.go regarding model validation and suggested a performance enhancement for model lookups in model_definitions.go.
| translated = NormalizeThinkingConfig(translated, req.Model, allowCompat) | ||
| if errValidate := ValidateThinkingConfig(translated, req.Model); errValidate != nil { | ||
| return resp, errValidate | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NormalizeThinkingConfig and ValidateThinkingConfig functions are called with req.Model, but they should use the modelOverride if it's available. This is inconsistent with other executors (e.g., codex_executor.go) and could lead to incorrect thinking configuration validation if an alias maps to a model with different capabilities. The actual model that will be used for the upstream request should be used for validation.
model := req.Model
if modelOverride != "" {
model = modelOverride
}
translated = NormalizeThinkingConfig(translated, model, allowCompat)
if errValidate := ValidateThinkingConfig(translated, model); errValidate != nil {
return resp, errValidate
}| translated = NormalizeThinkingConfig(translated, req.Model, allowCompat) | ||
| if errValidate := ValidateThinkingConfig(translated, req.Model); errValidate != nil { | ||
| return nil, errValidate | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the Execute method, NormalizeThinkingConfig and ValidateThinkingConfig should use the modelOverride if it exists, instead of req.Model. This ensures the thinking configuration is validated against the actual upstream model.
model := req.Model
if modelOverride != "" {
model = modelOverride
}
translated = NormalizeThinkingConfig(translated, model, allowCompat)
if errValidate := ValidateThinkingConfig(translated, model); errValidate != nil {
return nil, errValidate
}| // LookupStaticModelInfo searches all static model definitions for a model by ID. | ||
| // Returns nil if no matching model is found. | ||
| func LookupStaticModelInfo(modelID string) *ModelInfo { | ||
| if modelID == "" { | ||
| return nil | ||
| } | ||
| allModels := [][]*ModelInfo{ | ||
| GetClaudeModels(), | ||
| GetGeminiModels(), | ||
| GetGeminiVertexModels(), | ||
| GetGeminiCLIModels(), | ||
| GetAIStudioModels(), | ||
| GetOpenAIModels(), | ||
| GetQwenModels(), | ||
| GetIFlowModels(), | ||
| } | ||
| for _, models := range allModels { | ||
| for _, m := range models { | ||
| if m != nil && m.ID == modelID { | ||
| return m | ||
| } | ||
| } | ||
| } | ||
| return nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation of LookupStaticModelInfo re-creates a slice of all model groups on every call. For better performance and cleaner code, consider initializing a map of all static models once and then performing a simple map lookup. This would be more efficient, especially if the number of models grows.
You can add the following at the package level:
import "sync"
var (
allStaticModels map[string]*ModelInfo
initOnce sync.Once
)
func initializeStaticModels() {
allStaticModels = make(map[string]*ModelInfo)
modelGroups := [][]*ModelInfo{
GetClaudeModels(),
GetGeminiModels(),
GetGeminiVertexModels(),
GetGeminiCLIModels(),
GetAIStudioModels(),
GetOpenAIModels(),
GetQwenModels(),
GetIFlowModels(),
}
for _, group := range modelGroups {
for _, model := range group {
if model != nil && model.ID != "" {
if _, exists := allStaticModels[model.ID]; !exists {
allStaticModels[model.ID] = model
}
}
}
}
}And then replace the function with this suggestion.
// LookupStaticModelInfo searches all static model definitions for a model by ID.
// Returns nil if no matching model is found.
func LookupStaticModelInfo(modelID string) *ModelInfo {
initOnce.Do(initializeStaticModels)
if modelID == "" {
return nil
}
return allStaticModels[modelID]
}
No description provided.