fix(opencode): generate reasoning variants for all OpenRouter models. (#30332)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
parent
a86ecf3bba
commit
161247c70d
2 changed files with 30 additions and 9 deletions
|
|
@ -2666,7 +2666,7 @@ describe("ProviderTransform.variants", () => {
|
|||
})
|
||||
|
||||
describe("@openrouter/ai-sdk-provider", () => {
|
||||
test("returns empty object for non-qualifying models", () => {
|
||||
test("returns widely supported efforts for other reasoning models", () => {
|
||||
const model = createMockModel({
|
||||
id: "openrouter/test-model",
|
||||
providerID: "openrouter",
|
||||
|
|
@ -2677,7 +2677,8 @@ describe("ProviderTransform.variants", () => {
|
|||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({})
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
expect(result.medium).toEqual({ reasoning: { effort: "medium" } })
|
||||
})
|
||||
|
||||
test("gpt models return OPENAI_EFFORTS with reasoning", () => {
|
||||
|
|
@ -2697,6 +2698,7 @@ describe("ProviderTransform.variants", () => {
|
|||
})
|
||||
|
||||
for (const testCase of [
|
||||
{ id: "openai/o3-mini", efforts: ["none", "minimal", "low", "medium", "high", "xhigh"] },
|
||||
{ id: "openai/gpt-5.4", efforts: ["none", "low", "medium", "high", "xhigh"] },
|
||||
{ id: "openai/gpt-5-pro", efforts: ["high"] },
|
||||
{ id: "openai/gpt-5.5-pro", efforts: ["medium", "high", "xhigh"] },
|
||||
|
|
@ -2722,7 +2724,7 @@ describe("ProviderTransform.variants", () => {
|
|||
})
|
||||
}
|
||||
|
||||
test("gemini-3 returns OPENAI_EFFORTS with reasoning", () => {
|
||||
test("gemini-3 returns widely supported efforts with reasoning", () => {
|
||||
const model = createMockModel({
|
||||
id: "openrouter/gemini-3-5-pro",
|
||||
providerID: "openrouter",
|
||||
|
|
@ -2733,7 +2735,7 @@ describe("ProviderTransform.variants", () => {
|
|||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["none", "minimal", "low", "medium", "high", "xhigh"])
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
})
|
||||
|
||||
test("grok-4 returns empty object", () => {
|
||||
|
|
@ -3985,6 +3987,23 @@ describe("ProviderTransform.smallOptions - gpt-5 chat/search", () => {
|
|||
}
|
||||
})
|
||||
|
||||
test("ProviderTransform.smallOptions disables OpenRouter reasoning when the weakest effort is low", () => {
|
||||
expect(
|
||||
ProviderTransform.smallOptions({
|
||||
providerID: "openrouter",
|
||||
api: {
|
||||
id: "anthropic/claude-sonnet-4.6",
|
||||
npm: "@openrouter/ai-sdk-provider",
|
||||
},
|
||||
variants: {
|
||||
low: { reasoning: { effort: "low" } },
|
||||
medium: { reasoning: { effort: "medium" } },
|
||||
high: { reasoning: { effort: "high" } },
|
||||
},
|
||||
} as any),
|
||||
).toEqual({ reasoning: { effort: "none" } })
|
||||
})
|
||||
|
||||
describe("ProviderTransform.smallOptions - google thinking controls", () => {
|
||||
const createGoogleModel = (apiId: string) => {
|
||||
const model = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue