فهرست منبع

fix(provider): correct MiniMax M3 thinking variants (#38330)

Aiden Cline 3 هفته پیش
والد
کامیت
50eee1f5a4
2فایلهای تغییر یافته به همراه22 افزوده شده و 0 حذف شده
  1. 6 0
      packages/opencode/src/provider/transform.ts
  2. 16 0
      packages/opencode/test/provider/transform.test.ts

+ 6 - 0
packages/opencode/src/provider/transform.ts

@@ -693,6 +693,12 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
     model.api.id.toLowerCase().includes("minimax-m3") &&
     model.api.id.toLowerCase().includes("minimax-m3") &&
     ["@ai-sdk/anthropic", "@ai-sdk/openai-compatible"].includes(model.api.npm)
     ["@ai-sdk/anthropic", "@ai-sdk/openai-compatible"].includes(model.api.npm)
   ) {
   ) {
+    if (["nvidia", "lilac"].includes(model.providerID)) {
+      return {
+        none: { chat_template_kwargs: { thinking_mode: "disabled" } },
+        thinking: { chat_template_kwargs: { thinking_mode: "enabled" } },
+      }
+    }
     return {
     return {
       none: { thinking: { type: "disabled" } },
       none: { thinking: { type: "disabled" } },
       thinking: { thinking: { type: "adaptive" } },
       thinking: { thinking: { type: "adaptive" } },

+ 16 - 0
packages/opencode/test/provider/transform.test.ts

@@ -3468,6 +3468,22 @@ describe("ProviderTransform.variants", () => {
     })
     })
   })
   })
 
 
+  test.each(["nvidia", "lilac"])("%s minimax m3 returns chat template thinking toggles", (providerID) => {
+    const model = createMockModel({
+      id: `${providerID}/minimaxai/minimax-m3`,
+      providerID,
+      api: {
+        id: "minimaxai/minimax-m3",
+        url: "https://api.example.com/v1",
+        npm: "@ai-sdk/openai-compatible",
+      },
+    })
+    expect(ProviderTransform.variants(model)).toEqual({
+      none: { chat_template_kwargs: { thinking_mode: "disabled" } },
+      thinking: { chat_template_kwargs: { thinking_mode: "enabled" } },
+    })
+  })
+
   test("glm returns empty object", () => {
   test("glm returns empty object", () => {
     const model = createMockModel({
     const model = createMockModel({
       id: "glm/glm-4",
       id: "glm/glm-4",