fix(provider): tweak reasoning option driven max budget variants (#36626)

This commit is contained in:
Aiden Cline
2026-07-13 09:18:32 -05:00
committed by GitHub
parent b3a012cbdd
commit 99668cfdce
2 changed files with 35 additions and 13 deletions
+4 -8
View File
@@ -1611,17 +1611,13 @@ function effortVariants(model: Provider.Model, values: readonly unknown[]) {
}
function budgetVariants(model: Provider.Model, min?: number, max?: number) {
const limit = model.limit.output - 1
if (limit <= 0) return {}
const high = Math.min(
max === undefined ? Math.max(min ?? 0, 16_000) : Math.min(Math.max(min ?? 0, 16_000), max),
limit,
)
const maximum = max === undefined ? undefined : Math.min(max, limit)
const maximum = Math.min(max ?? OUTPUT_TOKEN_MAX - 1, model.limit.output - 1, OUTPUT_TOKEN_MAX - 1)
if (maximum <= 0) return {}
const high = Math.min(Math.max(min ?? 0, Math.floor((maximum + 1) / 2)), maximum)
return Object.fromEntries(
[
{ id: "high", budget: high },
...(maximum === undefined || maximum === high ? [] : [{ id: "max", budget: maximum }]),
{ id: "max", budget: maximum },
].flatMap((item) => {
const settings = reasoningBudget(model, item.budget)
return settings ? [[item.id, settings]] : []