Revert "fix(provider): preserve legacy reasoning fallback guards"
This reverts commit 5d3588962a.
This commit is contained in:
parent
5d3588962a
commit
9ef5212e09
3 changed files with 4 additions and 122 deletions
|
|
@ -812,63 +812,6 @@ function reasoningOptionVariants(model: Provider.Model): Record<string, Record<s
|
|||
return {}
|
||||
}
|
||||
|
||||
function legacyHeuristicVariants(model: Provider.Model): Record<string, Record<string, any>> | undefined {
|
||||
const id = model.id.toLowerCase()
|
||||
const apiID = model.api.id.toLowerCase()
|
||||
const includes = (value: string) => id.includes(value) || apiID.includes(value)
|
||||
const glm52 = ["glm-5.2", "glm-5-2", "glm-5p2"].some(includes)
|
||||
|
||||
if (glm52 && model.api.npm === "@openrouter/ai-sdk-provider") {
|
||||
return {
|
||||
high: { reasoning: { effort: "high" } },
|
||||
xhigh: { reasoning: { effort: "xhigh" } },
|
||||
}
|
||||
}
|
||||
if (glm52 && model.api.npm === "@ai-sdk/openai-compatible") {
|
||||
return {
|
||||
high: { reasoningEffort: "high" },
|
||||
max: { reasoningEffort: "max" },
|
||||
}
|
||||
}
|
||||
if (glm52 && model.api.npm === "@ai-sdk/anthropic") {
|
||||
return {
|
||||
high: { effort: "high" },
|
||||
max: { effort: "max" },
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
includes("deepseek-chat") ||
|
||||
includes("deepseek-reasoner") ||
|
||||
includes("deepseek-r1") ||
|
||||
includes("deepseek-v3") ||
|
||||
includes("minimax") ||
|
||||
(includes("glm") && !glm52) ||
|
||||
includes("kimi") ||
|
||||
includes("k2p") ||
|
||||
includes("qwen") ||
|
||||
includes("big-pickle")
|
||||
) {
|
||||
return {}
|
||||
}
|
||||
|
||||
if (includes("grok") && includes("grok-3-mini")) {
|
||||
if (model.api.npm === "@openrouter/ai-sdk-provider") {
|
||||
return {
|
||||
low: { reasoning: { effort: "low" } },
|
||||
high: { reasoning: { effort: "high" } },
|
||||
}
|
||||
}
|
||||
return {
|
||||
low: { reasoningEffort: "low" },
|
||||
high: { reasoningEffort: "high" },
|
||||
}
|
||||
}
|
||||
if (includes("grok")) return {}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function variants(model: Provider.Model): Record<string, Record<string, any>> {
|
||||
if (!model.capabilities.reasoning) return {}
|
||||
|
||||
|
|
@ -887,9 +830,6 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
|||
const fromReasoningOptions = reasoningOptionVariants(model)
|
||||
if (fromReasoningOptions) return fromReasoningOptions
|
||||
|
||||
const fromLegacyHeuristics = legacyHeuristicVariants(model)
|
||||
if (fromLegacyHeuristics) return fromLegacyHeuristics
|
||||
|
||||
switch (model.api.npm) {
|
||||
case "@openrouter/ai-sdk-provider":
|
||||
return Object.fromEntries(WIDELY_SUPPORTED_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||
|
|
|
|||
|
|
@ -1677,35 +1677,6 @@ it.instance(
|
|||
},
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"custom config deepseek reasoning model without variants keeps legacy empty variants",
|
||||
Effect.gen(function* () {
|
||||
const providers = yield* list
|
||||
const model = providers[ProviderV2.ID.make("custom-deepseek")].models["deepseek-r1"]
|
||||
expect(model.reasoning_options).toBeUndefined()
|
||||
expect(model.variants).toEqual({})
|
||||
}),
|
||||
{
|
||||
config: {
|
||||
provider: {
|
||||
"custom-deepseek": {
|
||||
name: "Custom DeepSeek",
|
||||
npm: "@ai-sdk/openai-compatible",
|
||||
env: [],
|
||||
models: {
|
||||
"deepseek-r1": {
|
||||
name: "DeepSeek R1",
|
||||
reasoning: true,
|
||||
limit: { context: 128000, output: 16000 },
|
||||
},
|
||||
},
|
||||
options: { apiKey: "test-key" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"custom model with variants enabled and disabled",
|
||||
Effect.gen(function* () {
|
||||
|
|
|
|||
|
|
@ -3135,27 +3135,12 @@ describe("ProviderTransform.variants", () => {
|
|||
url: "https://api.deepseek.com",
|
||||
npm: "@ai-sdk/openai-compatible",
|
||||
},
|
||||
reasoning_options: [],
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({})
|
||||
})
|
||||
|
||||
test.each(["deepseek-r1", "qwen3", "kimi-k2", "glm-4.6", "big-pickle"])(
|
||||
"%s without reasoning_options keeps legacy empty fallback",
|
||||
(apiID) => {
|
||||
const model = createMockModel({
|
||||
id: `custom/${apiID}`,
|
||||
providerID: "custom",
|
||||
api: {
|
||||
id: apiID,
|
||||
url: "https://api.custom.com",
|
||||
npm: "@ai-sdk/openai-compatible",
|
||||
},
|
||||
})
|
||||
expect(ProviderTransform.variants(model)).toEqual({})
|
||||
},
|
||||
)
|
||||
|
||||
test("minimax returns empty object", () => {
|
||||
const model = createMockModel({
|
||||
id: "minimax/minimax-model",
|
||||
|
|
@ -3165,6 +3150,7 @@ describe("ProviderTransform.variants", () => {
|
|||
url: "https://api.minimax.com",
|
||||
npm: "@ai-sdk/openai-compatible",
|
||||
},
|
||||
reasoning_options: [],
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({})
|
||||
|
|
@ -3493,7 +3479,7 @@ describe("ProviderTransform.variants", () => {
|
|||
})
|
||||
|
||||
describe("@ai-sdk/xai", () => {
|
||||
test("grok-3 returns empty object", () => {
|
||||
test("returns WIDELY_SUPPORTED_EFFORTS with reasoningEffort", () => {
|
||||
const model = createMockModel({
|
||||
id: "xai/grok-3",
|
||||
providerID: "xai",
|
||||
|
|
@ -3504,23 +3490,8 @@ describe("ProviderTransform.variants", () => {
|
|||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({})
|
||||
})
|
||||
|
||||
test("grok-3-mini returns low and high with reasoningEffort", () => {
|
||||
const model = createMockModel({
|
||||
id: "xai/grok-3-mini",
|
||||
providerID: "xai",
|
||||
api: {
|
||||
id: "grok-3-mini",
|
||||
url: "https://api.x.ai",
|
||||
npm: "@ai-sdk/xai",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "high"])
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
expect(result.low).toEqual({ reasoningEffort: "low" })
|
||||
expect(result.high).toEqual({ reasoningEffort: "high" })
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue