fix(model-capabilities): honor root thinking flags

This commit is contained in:
Ravi Tharuma
2026-03-25 15:41:12 +01:00
parent 613ef8eee8
commit 7c0289d7bc
2 changed files with 21 additions and 0 deletions
+16
View File
@@ -115,6 +115,22 @@ describe("getModelCapabilities", () => {
})
})
test("respects root-level thinking flags when providers do not nest them under capabilities", () => {
const result = getModelCapabilities({
providerID: "custom-proxy",
modelID: "gpt-5.4",
runtimeModel: {
supportsThinking: true,
},
bundledSnapshot,
})
expect(result).toMatchObject({
canonicalModelID: "gpt-5.4",
supportsThinking: true,
})
})
test("accepts runtime variant arrays without corrupting them into numeric keys", () => {
const result = getModelCapabilities({
providerID: "openai",
+5
View File
@@ -276,6 +276,11 @@ function readRuntimeModelThinkingSupport(runtimeModel: Record<string, unknown> |
return capabilityValue
}
const rootThinkingSupport = readRuntimeModelBoolean(runtimeModel, ["thinking", "supportsThinking"])
if (rootThinkingSupport !== undefined) {
return rootThinkingSupport
}
const runtimeCapabilities = readRuntimeModelCapabilities(runtimeModel)
if (!runtimeCapabilities) {
return undefined