mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-20 23:13:31 +00:00
fix(opencode): expose Grok reasoning variants (#36017)
This commit is contained in:
parent
0abbcddac2
commit
1db5c2402c
2 changed files with 8 additions and 7 deletions
|
|
@ -734,7 +734,6 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
|||
high: { reasoningEffort: "high" },
|
||||
}
|
||||
}
|
||||
if (id.includes("grok")) return {}
|
||||
|
||||
switch (model.api.npm) {
|
||||
case "@openrouter/ai-sdk-provider":
|
||||
|
|
|
|||
|
|
@ -3339,7 +3339,7 @@ describe("ProviderTransform.variants", () => {
|
|||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
})
|
||||
|
||||
test("grok-4 returns empty object", () => {
|
||||
test("grok-4 uses the provider's standard efforts", () => {
|
||||
const model = createMockModel({
|
||||
id: "openrouter/grok-4",
|
||||
providerID: "openrouter",
|
||||
|
|
@ -3350,7 +3350,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("grok-3-mini returns low and high with reasoning", () => {
|
||||
|
|
@ -3766,18 +3767,19 @@ describe("ProviderTransform.variants", () => {
|
|||
})
|
||||
|
||||
describe("@ai-sdk/xai", () => {
|
||||
test("grok-3 returns empty object", () => {
|
||||
test("grok-4.5 uses standard reasoning efforts", () => {
|
||||
const model = createMockModel({
|
||||
id: "xai/grok-3",
|
||||
id: "xai/grok-4.5",
|
||||
providerID: "xai",
|
||||
api: {
|
||||
id: "grok-3",
|
||||
id: "grok-4.5",
|
||||
url: "https://api.x.ai",
|
||||
npm: "@ai-sdk/xai",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({})
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
expect(result.medium).toEqual({ reasoningEffort: "medium" })
|
||||
})
|
||||
|
||||
test("grok-3-mini returns low and high with reasoningEffort", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue