fix(model-capabilities): harden runtime capability handling

This commit is contained in:
Ravi Tharuma
2026-03-25 15:09:25 +01:00
parent 2af9324400
commit 613ef8eee8
8 changed files with 296 additions and 23 deletions
@@ -324,6 +324,27 @@ describe("resolveCompatibleModelSettings", () => {
})
})
test("GPT-5 downgrades unsupported max variant to xhigh", () => {
const result = resolveCompatibleModelSettings({
providerID: "openai",
modelID: "gpt-5.4",
desired: { variant: "max" },
})
expect(result).toEqual({
variant: "xhigh",
reasoningEffort: undefined,
changes: [
{
field: "variant",
from: "max",
to: "xhigh",
reason: "unsupported-by-model-family",
},
],
})
})
// Reasoning effort: "none" and "minimal" are valid per Vercel AI SDK
test("GPT-5 keeps none reasoningEffort", () => {
const result = resolveCompatibleModelSettings({