Skip to content

Commit 50eee1f

Browse files
authored
fix(provider): correct MiniMax M3 thinking variants (anomalyco#38330)
1 parent 0a601cf commit 50eee1f

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎packages/opencode/src/provider/transform.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,12 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
693693
model.api.id.toLowerCase().includes("minimax-m3") &&
694694
["@ai-sdk/anthropic", "@ai-sdk/openai-compatible"].includes(model.api.npm)
695695
) {
696+
if (["nvidia", "lilac"].includes(model.providerID)) {
697+
return {
698+
none: { chat_template_kwargs: { thinking_mode: "disabled" } },
699+
thinking: { chat_template_kwargs: { thinking_mode: "enabled" } },
700+
}
701+
}
696702
return {
697703
none: { thinking: { type: "disabled" } },
698704
thinking: { thinking: { type: "adaptive" } },

‎packages/opencode/test/provider/transform.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3468,6 +3468,22 @@ describe("ProviderTransform.variants", () => {
34683468
})
34693469
})
34703470

3471+
test.each(["nvidia", "lilac"])("%s minimax m3 returns chat template thinking toggles", (providerID) => {
3472+
const model = createMockModel({
3473+
id: `${providerID}/minimaxai/minimax-m3`,
3474+
providerID,
3475+
api: {
3476+
id: "minimaxai/minimax-m3",
3477+
url: "https://api.example.com/v1",
3478+
npm: "@ai-sdk/openai-compatible",
3479+
},
3480+
})
3481+
expect(ProviderTransform.variants(model)).toEqual({
3482+
none: { chat_template_kwargs: { thinking_mode: "disabled" } },
3483+
thinking: { chat_template_kwargs: { thinking_mode: "enabled" } },
3484+
})
3485+
})
3486+
34713487
test("glm returns empty object", () => {
34723488
const model = createMockModel({
34733489
id: "glm/glm-4",

0 commit comments

Comments
 (0)