fix(ai): correct thinking budget for 2.5-flash-lite models (#2861)

The 2.5-flash-lite model was incorrectly matching the 2.5-flash
case, setting minimal budget to 128. Per Google's docs, flash-lite's
minimum thinking budget is 512, not 128. This caused the error:

  The thinking budget 128 is invalid. Please choose a value between
  512 and 24576.

Add a dedicated 2.5-flash-lite case before the 2.5-flash case so
the more specific match takes priority.

Fixes #2838

Co-authored-by: JasonOA888 <JasonOA888@users.noreply.github.com>
This commit is contained in:
Jason
2026-04-09 09:03:45 +08:00
committed by GitHub
parent 61015830ed
commit b48d802930

View File

@@ -462,6 +462,16 @@ function getGoogleBudget(
return budgets[effort];
}
if (model.id.includes("2.5-flash-lite")) {
const budgets: Record<ClampedThinkingLevel, number> = {
minimal: 512,
low: 2048,
medium: 8192,
high: 24576,
};
return budgets[effort];
}
if (model.id.includes("2.5-flash")) {
const budgets: Record<ClampedThinkingLevel, number> = {
minimal: 128,