Fix Kimi and Xiaomi model metadata
Closes #5075, closes #5078. Refs #5087.
This commit is contained in:
@@ -995,6 +995,51 @@ describe("openai-completions tool_choice", () => {
|
||||
expect(messages[0]).not.toHaveProperty("reasoning");
|
||||
});
|
||||
|
||||
it("sends thinking none for OpenCode Go Kimi K2.6 when thinking is off", async () => {
|
||||
const model = getModel("opencode-go", "kimi-k2.6")!;
|
||||
let payload: unknown;
|
||||
|
||||
await streamSimple(
|
||||
model,
|
||||
{
|
||||
messages: [{ role: "user", content: "Hi", timestamp: Date.now() }],
|
||||
},
|
||||
{
|
||||
apiKey: "test",
|
||||
onPayload: (params: unknown) => {
|
||||
payload = params;
|
||||
},
|
||||
},
|
||||
).result();
|
||||
|
||||
const params = (payload ?? mockState.lastParams) as { thinking?: string; reasoning_effort?: string };
|
||||
expect(params.thinking).toBe("none");
|
||||
expect(params.reasoning_effort).toBeUndefined();
|
||||
});
|
||||
|
||||
it("sends thinking effort for OpenCode Go Kimi K2.6 when thinking is enabled", async () => {
|
||||
const model = getModel("opencode-go", "kimi-k2.6")!;
|
||||
let payload: unknown;
|
||||
|
||||
await streamSimple(
|
||||
model,
|
||||
{
|
||||
messages: [{ role: "user", content: "Hi", timestamp: Date.now() }],
|
||||
},
|
||||
{
|
||||
apiKey: "test",
|
||||
reasoning: "high",
|
||||
onPayload: (params: unknown) => {
|
||||
payload = params;
|
||||
},
|
||||
},
|
||||
).result();
|
||||
|
||||
const params = (payload ?? mockState.lastParams) as { thinking?: string; reasoning_effort?: string };
|
||||
expect(params.thinking).toBe("high");
|
||||
expect(params.reasoning_effort).toBeUndefined();
|
||||
});
|
||||
|
||||
it("does not double-count reasoning tokens in completion usage", async () => {
|
||||
mockState.chunks = [
|
||||
{
|
||||
|
||||
15
packages/ai/test/xiaomi-models.test.ts
Normal file
15
packages/ai/test/xiaomi-models.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel, getModels } from "../src/models.ts";
|
||||
|
||||
describe("Xiaomi MiMo models", () => {
|
||||
it("keeps mimo-v2-flash on the API billing provider", () => {
|
||||
expect(getModel("xiaomi", "mimo-v2-flash")).toBeDefined();
|
||||
});
|
||||
|
||||
it.each(["xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"] as const)(
|
||||
"omits mimo-v2-flash from %s",
|
||||
(provider) => {
|
||||
expect(getModels(provider).some((model) => model.id === "mimo-v2-flash")).toBe(false);
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user