mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 15:51:35 +00:00
* fix(kimi): retire k3[1m], add k3-256k, k3 now 1M * fix(kimi): integrate K3 256K catalog split * docs(kimi): correct K3 thinking-level ladder in thinking.md
96 lines
2.5 KiB
TypeScript
96 lines
2.5 KiB
TypeScript
// Kimi Coding tests cover index plugin behavior.
|
|
import { registerSingleProviderPlugin } from "openclaw/plugin-sdk/plugin-test-runtime";
|
|
import { describe, expect, it } from "vitest";
|
|
import plugin from "./index.js";
|
|
|
|
describe("kimi provider plugin", () => {
|
|
it("normalizes legacy Kimi Code ids to the stable API model id", async () => {
|
|
const provider = await registerSingleProviderPlugin(plugin);
|
|
|
|
expect(
|
|
provider.normalizeResolvedModel?.({
|
|
provider: "kimi",
|
|
modelId: "kimi-code",
|
|
model: {
|
|
id: "kimi-code",
|
|
name: "Kimi Code",
|
|
provider: "kimi",
|
|
api: "anthropic-messages",
|
|
},
|
|
} as never),
|
|
).toEqual({
|
|
id: "kimi-for-coding",
|
|
name: "Kimi Code",
|
|
provider: "kimi",
|
|
api: "anthropic-messages",
|
|
});
|
|
|
|
expect(provider.normalizeModelId?.({ provider: "kimi", modelId: "k3[1m]" } as never)).toBe(
|
|
"k3",
|
|
);
|
|
});
|
|
|
|
it("uses binary thinking with thinking off by default", async () => {
|
|
const provider = await registerSingleProviderPlugin(plugin);
|
|
|
|
expect(
|
|
provider.resolveThinkingProfile?.({
|
|
provider: "kimi",
|
|
modelId: "kimi-code",
|
|
reasoning: true,
|
|
} as never),
|
|
).toEqual({
|
|
levels: [
|
|
{ id: "off", label: "off" },
|
|
{ id: "low", label: "on" },
|
|
],
|
|
defaultLevel: "off",
|
|
});
|
|
});
|
|
|
|
it.each(["k3", "k3-256k"])("exposes %s adaptive thinking levels", async (modelId) => {
|
|
const provider = await registerSingleProviderPlugin(plugin);
|
|
|
|
expect(
|
|
provider.resolveThinkingProfile?.({
|
|
provider: "kimi",
|
|
modelId,
|
|
reasoning: true,
|
|
} as never),
|
|
).toEqual({
|
|
levels: [
|
|
{ id: "off" },
|
|
{ id: "minimal" },
|
|
{ id: "low" },
|
|
{ id: "medium" },
|
|
{ id: "high" },
|
|
{ id: "adaptive" },
|
|
{ id: "xhigh" },
|
|
{ id: "max" },
|
|
],
|
|
defaultLevel: "high",
|
|
preserveWhenCatalogReasoningFalse: true,
|
|
});
|
|
});
|
|
|
|
it("wraps K3 simple completions without changing K2 simple completions", async () => {
|
|
const provider = await registerSingleProviderPlugin(plugin);
|
|
const streamFn = (() => undefined) as never;
|
|
|
|
expect(
|
|
provider.wrapSimpleCompletionStreamFn?.({
|
|
provider: "kimi",
|
|
modelId: "k3",
|
|
streamFn,
|
|
} as never),
|
|
).not.toBe(streamFn);
|
|
expect(
|
|
provider.wrapSimpleCompletionStreamFn?.({
|
|
provider: "kimi",
|
|
modelId: "kimi-for-coding",
|
|
streamFn,
|
|
} as never),
|
|
).toBe(streamFn);
|
|
});
|
|
});
|