Skip to content

Commit 82775cc

Browse files
anandgupta42claude
andcommitted
fix: keep the substring rule for Gemini 3 ids without a parseable generation
Ids such as `vertex_gemini-3pro` matched the earlier `includes("gemini-3")` check but not the generation regex, so they fell back to `thinkingBudget: 0`. Adds prefixed, dated-preview and unparseable id cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 380beb3 commit 82775cc

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎packages/opencode/src/provider/transform.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,8 @@ export namespace ProviderTransform {
13561356
) {
13571357
const id = model.api.id.toLowerCase()
13581358
const generation = Number(/(?:^|\/)gemini-(\d+)(?:[.-]|$)/.exec(id)?.[1])
1359-
if (generation === 3) {
1359+
// Fall back to the earlier substring rule when the id has no parseable generation.
1360+
if (generation === 3 || (Number.isNaN(generation) && id.includes("gemini-3"))) {
13601361
return { thinkingConfig: { thinkingLevel: "minimal" } }
13611362
}
13621363
// Gemini 2.x and unversioned aliases (e.g. gemini-flash-latest) keep the budget control.

‎packages/opencode/test/provider/transform.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ describe("ProviderTransform.smallOptions - google thinking", () => {
317317
{ id: "gemini-2.5-flash", thinkingConfig: { thinkingBudget: 0 } },
318318
{ id: "gemini-3-pro", thinkingConfig: { thinkingLevel: "minimal" } },
319319
{ id: "gemini-3.1-pro", thinkingConfig: { thinkingLevel: "minimal" } },
320+
{ id: "models/gemini-3-pro-preview", thinkingConfig: { thinkingLevel: "minimal" } },
321+
{ id: "vertex_gemini-3pro", thinkingConfig: { thinkingLevel: "minimal" } },
322+
{ id: "gemini-2.5-flash-lite-preview-06-17", thinkingConfig: { thinkingBudget: 0 } },
320323
{ id: "gemini-4-argon", thinkingConfig: { thinkingLevel: "low" } },
321324
{ id: "gemini-5-pro", thinkingConfig: { thinkingLevel: "low" } },
322325
{ id: "gemini-30-pro", thinkingConfig: { thinkingLevel: "low" } },

0 commit comments

Comments
 (0)