Revert "fix(provider): prefer gemini 2.5 reasoning budgets"

This reverts commit 49a02e2b95.
This commit is contained in:
Aiden Cline 2026-06-30 17:41:07 -05:00
commit 36ed0f4878
2 changed files with 12 additions and 52 deletions

View file

@ -577,14 +577,6 @@ function googleThinkingLevelVariants() {
)
}
function googleThinkingBudgetVariants(budget: ReasoningBudgetOption, model: Provider.Model) {
return reasoningBudgetVariants(
budget,
(thinkingBudget) => ({ thinkingConfig: { includeThoughts: true, thinkingBudget } }),
model.limit.output,
)
}
function openAIReasoningEffortVariants() {
return Object.fromEntries(
OPENAI_EFFORTS.map((effort) => [
@ -623,25 +615,6 @@ function reasoningBudgetVariants(
}
}
function gemini25BudgetVariants(model: Provider.Model, budget: ReasoningBudgetOption) {
// Gemini 2.5 uses numeric thinking budgets in the Google SDK; thinkingLevel is for Gemini 3.
if (!idIncludes(model, "gemini-2.5") && !idIncludes(model, "gemini-2-5")) return undefined
switch (model.api.npm) {
case "@ai-sdk/gateway":
if (idIncludes(model, "google")) return googleThinkingBudgetVariants(budget, model)
return undefined
case "@ai-sdk/google":
case "@ai-sdk/google-vertex":
return googleThinkingBudgetVariants(budget, model)
case "@jerome-benoit/sap-ai-provider-v2":
return wrapInSapModelParams(googleThinkingBudgetVariants(budget, model))
}
return undefined
}
function anthropicAdaptiveFromOptions(effort: ReasoningEffortOption) {
return effort.values.includes("max")
}
@ -759,8 +732,6 @@ function reasoningOptionVariants(model: Provider.Model): Record<string, Record<s
if (!model.reasoning_options) return undefined
const effort = reasoningOption(model, "effort")
const budget = reasoningOption(model, "budget_tokens")
const gemini25Budget = budget ? gemini25BudgetVariants(model, budget) : undefined
if (gemini25Budget) return gemini25Budget
if (effort) {
return Object.fromEntries(
@ -792,7 +763,11 @@ function reasoningOptionVariants(model: Provider.Model): Record<string, Record<s
)
}
if (idIncludes(model, "google")) {
return googleThinkingBudgetVariants(budget, model)
return reasoningBudgetVariants(
budget,
(thinkingBudget) => ({ thinkingConfig: { includeThoughts: true, thinkingBudget } }),
model.limit.output,
)
}
break
@ -812,7 +787,11 @@ function reasoningOptionVariants(model: Provider.Model): Record<string, Record<s
case "@ai-sdk/google":
case "@ai-sdk/google-vertex":
return googleThinkingBudgetVariants(budget, model)
return reasoningBudgetVariants(
budget,
(thinkingBudget) => ({ thinkingConfig: { includeThoughts: true, thinkingBudget } }),
model.limit.output,
)
case "@jerome-benoit/sap-ai-provider-v2":
if (model.api.id.includes("anthropic")) {

View file

@ -3220,10 +3220,7 @@ describe("ProviderTransform.variants", () => {
url: "https://gateway.ai",
npm: "@ai-sdk/gateway",
},
reasoning_options: [
{ type: "effort", values: ["minimal", "low", "medium", "high"] },
{ type: "budget_tokens", min: 128, max: 32768 },
],
reasoning_options: [{ type: "budget_tokens", min: 128, max: 32768 }],
}),
)
expect(Object.keys(result)).toEqual(["high", "max"])
@ -3772,10 +3769,7 @@ describe("ProviderTransform.variants", () => {
npm: provider.name,
},
reasoning_options: testCase.expectedMax
? [
{ type: "effort", values: ["minimal", "low", "medium", "high"] },
{ type: "budget_tokens", max: testCase.expectedMax.thinkingConfig.thinkingBudget },
]
? [{ type: "budget_tokens", max: testCase.expectedMax.thinkingConfig.thinkingBudget }]
: [{ type: "effort", values: testCase.efforts }],
}),
)
@ -3872,19 +3866,6 @@ describe("ProviderTransform.variants", () => {
},
})
})
test("uses reasoning_options budget tokens for Gemini 2.5 variants", () => {
const result = ProviderTransform.variants(
sapModel("gemini-2.5-pro", [
{ type: "effort", values: ["minimal", "low", "medium", "high"] },
{ type: "budget_tokens", min: 128, max: 32768 },
]),
)
expect(result).toEqual({
high: { modelParams: { thinkingConfig: { includeThoughts: true, thinkingBudget: 16_000 } } },
max: { modelParams: { thinkingConfig: { includeThoughts: true, thinkingBudget: 32_768 } } },
})
})
})
describe("ai-gateway-provider (cloudflare-ai-gateway)", () => {