-
-
Notifications
You must be signed in to change notification settings - Fork 81.1k
Expand file tree
/
Copy pathindex.test.ts
More file actions
95 lines (86 loc) 路 2.52 KB
/
Copy pathindex.test.ts
File metadata and controls
95 lines (86 loc) 路 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// 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);
});
});