-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Progressive migration to newer Gemini models and naming conventions #5990
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
base: main
Are you sure you want to change the base?
fix: Progressive migration to newer Gemini models and naming conventions #5990
Conversation
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.
Hey @HahaBill Thank you for your work on this, I left some minor points but I'll go ahead and approve the PR.
Also should we add a sunset date or version on which remove the migrations?
Let me know what you think!
} | ||
|
||
if (modelId.startsWith("gemini-1.5-pro-")) { | ||
return geminiDefaultModelId |
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.
I noticed an inconsistency in the model mapping logic between Gemini and Vertex handlers. Here, gemini-1.5-pro-*
maps to geminiDefaultModelId
, while in the Vertex handler it explicitly maps to gemini-2.0-flash-001
.
While both ultimately resolve to the same model (since geminiDefaultModelId
is gemini-2.0-flash-001
), would it be clearer to use the explicit model ID in both places for consistency? This would make the mapping logic more transparent and easier to maintain.
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.
Yeah, I was planning to do that but realised that geminiDefaultModelId
is a type of GeminiModelId
, whereas Vertex models are type of VertexModelId
. So there are different types.
(1) But gemini-2.0-flash-001
is currently hardcoded in the Vertex legacy mapping. I can actually create export const vertexDefaultGeminiModelId: VertexModelId = "gemini-2.0-flash-001"
so then it's easier to maintain.
(2) Or we can do geminiDefaultModelId to be type of VertexModelId
and GeminiModelId
.
Which one of the two options do you think is better? I saw there is a PR that tries to separate Vertex from Gemini so maybe option (1) sounds better?
let id = modelId ? this.mapLegacyGeminiModel(modelId) : geminiDefaultModelId | ||
|
||
if (modelId && modelId !== id) { | ||
this.options.apiModelId = id |
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.
I'm curious about the decision to modify this.options.apiModelId
directly here. Could this have unintended side effects if the options object is shared or referenced elsewhere?
Would it be safer to keep the original model ID unchanged and only use the mapped ID internally? This would preserve the original user configuration while still achieving the migration goal.
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.
Yeah, this is because of doing an immediate automatic sync between the backend and frontend (webview-ui). This is why the mapping function on the backend and frontend is the same.
If users choose another models from the selection in the profile settings then the original model id would be overwritten by new (non-legacy) model id and that is fine. This if (modelId && modelId !== id) {
will only happen if it's a legacy model.
We could just not do the mapping on the frontend-side but then users have to choose models for each Gemini profile. If not then the original (legacy) model ID might be still used (because that is still stored) and this could cause API errors because the original (legacy) model ID is not accessible by the Gemini API anymore.
I think the longer we keep the migration, the safer it is. Currently, it's summer so I expect people to not code that much :D I would say around mid-October sounds good. |
…m/HahaBill/Roo-Code into i/update-gemini-and-vertex-models
…-flash-preview-04-17:thinking
Related GitHub Issue
Closes: #5444
Description
Progressively migrating to new Gemini models and naming conventions. See in #5444.
Test Procedure
Frontend Testing
Backend Testing
GeminiHandler.getModel()
this.options.apiModelId
matches the frontend displayPre-Submission Checklist
Important
Update Gemini and Vertex models, add legacy model mapping, and enhance tests for model ID migration.
geminiModels
andvertexModels
ingemini.ts
andvertex.ts
to include new models and remove outdated ones.legacyGeminiModels
andlegacyVertexModels
to handle legacy model IDs.mapLegacyGeminiModel()
ingemini.ts
anduseSelectedModel.ts
to map legacy Gemini model IDs to current models.mapLegacyVertexModel()
invertex.ts
anduseSelectedModel.ts
to map legacy Vertex model IDs to current models.gemini.spec.ts
andvertex.spec.ts
to verify legacy model ID mapping to current models.This description was created by
for 6dab2cd. You can customize this summary. It will automatically update as commits are pushed.