mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 10:02:04 +08:00
feat(provider): add MiniMax M-series reasoning toggle
MiniMax models (id contains "minimax") were in the variants() exclusion list, so M3 exposed no reasoning control on any route despite supporting the Anthropic `thinking` field (type: adaptive | disabled). Remove minimax from the exclusion list and add instant/thinking variants, mirroring the glm/kimi/qwen toggle added in #8484: - @ai-sdk/anthropic (direct provider): map to native thinking:{type:"disabled"} / thinking:{type:"adaptive"} - @kilocode/kilo-gateway + @openrouter/ai-sdk-provider: reuse the reasoning:{enabled} shape, translated by kiloProviderOptions. Replace the obsolete "minimax returns empty object" test with coverage for the direct-anthropic and kilo-gateway routes.
This commit is contained in:
@@ -650,7 +650,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
id.includes("deepseek-reasoner") ||
|
||||
id.includes("deepseek-r1") ||
|
||||
id.includes("deepseek-v3") ||
|
||||
id.includes("minimax") ||
|
||||
// id.includes("minimax") || // kilocode_change
|
||||
// id.includes("glm") || // kilocode_change
|
||||
// id.includes("kimi") || // kilocode_change
|
||||
// TODO: Remove this after models.dev data is fixed to use "kimi-k2.5" instead of "k2p5"
|
||||
@@ -680,7 +680,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
case "@kilocode/kilo-gateway": // kilocode_change
|
||||
case "@openrouter/ai-sdk-provider":
|
||||
// kilocode_change start
|
||||
if (id.includes("glm") || id.includes("kimi") || id.includes("qwen")) {
|
||||
if (id.includes("glm") || id.includes("kimi") || id.includes("qwen") || id.includes("minimax")) {
|
||||
return {
|
||||
instant: { reasoning: { enabled: false } },
|
||||
thinking: { reasoning: { enabled: true } },
|
||||
@@ -856,6 +856,14 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/anthropic
|
||||
case "@ai-sdk/google-vertex/anthropic":
|
||||
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/google-vertex#anthropic-provider
|
||||
// kilocode_change start - MiniMax M-series toggles thinking on/off rather than exposing effort levels
|
||||
if (id.includes("minimax")) {
|
||||
return {
|
||||
instant: { thinking: { type: "disabled" } },
|
||||
thinking: { thinking: { type: "adaptive" } },
|
||||
}
|
||||
}
|
||||
// kilocode_change end
|
||||
if (adaptiveEfforts) {
|
||||
let efforts = [...adaptiveEfforts]
|
||||
if (model.providerID === "github-copilot") {
|
||||
|
||||
@@ -2410,18 +2410,38 @@ describe("ProviderTransform.variants", () => {
|
||||
expect(result).toEqual({})
|
||||
})
|
||||
|
||||
test("minimax returns empty object", () => {
|
||||
test("minimax direct anthropic provider returns instant/thinking toggle", () => {
|
||||
const model = createMockModel({
|
||||
id: "minimax/minimax-model",
|
||||
id: "minimax/MiniMax-M3",
|
||||
providerID: "minimax",
|
||||
api: {
|
||||
id: "minimax-model",
|
||||
url: "https://api.minimax.com",
|
||||
npm: "@ai-sdk/openai-compatible",
|
||||
id: "MiniMax-M3",
|
||||
url: "https://api.minimax.io/anthropic/v1",
|
||||
npm: "@ai-sdk/anthropic",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({})
|
||||
expect(result).toEqual({
|
||||
instant: { thinking: { type: "disabled" } },
|
||||
thinking: { thinking: { type: "adaptive" } },
|
||||
})
|
||||
})
|
||||
|
||||
test("minimax via kilo gateway returns instant/thinking toggle", () => {
|
||||
const model = createMockModel({
|
||||
id: "kilo/minimax/minimax-m3",
|
||||
providerID: "kilo",
|
||||
api: {
|
||||
id: "minimax/minimax-m3",
|
||||
url: "https://gateway.kilo.ai",
|
||||
npm: "@kilocode/kilo-gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({
|
||||
instant: { reasoning: { enabled: false } },
|
||||
thinking: { reasoning: { enabled: true } },
|
||||
})
|
||||
})
|
||||
|
||||
test("glm returns empty object", () => {
|
||||
|
||||
Reference in New Issue
Block a user