|
| 1 | +import type { ModelInfo } from "../model.js" |
| 2 | +import { MOONSHOT_DEFAULT_TEMPERATURE, moonshotDefaultModelId, moonshotModels } from "../providers/moonshot.js" |
| 3 | + |
| 4 | +const modelEntries: [string, ModelInfo][] = Object.entries(moonshotModels) |
| 5 | +const modelInfos: ModelInfo[] = Object.values(moonshotModels) |
| 6 | + |
| 7 | +describe("moonshot registry", () => { |
| 8 | + describe("moonshotModels registry invariants", () => { |
| 9 | + it("every entry has a positive maxTokens and contextWindow", () => { |
| 10 | + for (const [id, info] of modelEntries) { |
| 11 | + expect(info.maxTokens).toBeGreaterThan(0) |
| 12 | + expect(info.contextWindow).toBeGreaterThan(0) |
| 13 | + // Sanity: max output must not exceed the context window. |
| 14 | + expect(info.maxTokens).toBeLessThanOrEqual(info.contextWindow) |
| 15 | + void id |
| 16 | + } |
| 17 | + }) |
| 18 | + |
| 19 | + it("every entry declares supportsImages and supportsPromptCache", () => { |
| 20 | + for (const info of modelInfos) { |
| 21 | + expect(typeof info.supportsImages).toBe("boolean") |
| 22 | + expect(typeof info.supportsPromptCache).toBe("boolean") |
| 23 | + } |
| 24 | + }) |
| 25 | + |
| 26 | + it("models with an array supportsReasoningEffort expose a non-empty allow-list", () => { |
| 27 | + for (const info of modelInfos) { |
| 28 | + if (Array.isArray(info.supportsReasoningEffort)) { |
| 29 | + expect(info.supportsReasoningEffort.length).toBeGreaterThan(0) |
| 30 | + } |
| 31 | + } |
| 32 | + }) |
| 33 | + |
| 34 | + it("every entry declares a reasoningEffort that is covered by its allow-list", () => { |
| 35 | + for (const info of modelInfos) { |
| 36 | + if (Array.isArray(info.supportsReasoningEffort) && info.reasoningEffort !== undefined) { |
| 37 | + expect(info.supportsReasoningEffort).toContain(info.reasoningEffort) |
| 38 | + } |
| 39 | + } |
| 40 | + }) |
| 41 | + }) |
| 42 | + |
| 43 | + describe("kimi-k3", () => { |
| 44 | + it("exposes always-on reasoning with effort allow-list and reasoning preservation", () => { |
| 45 | + const info = moonshotModels["kimi-k3"] |
| 46 | + expect(info).toBeDefined() |
| 47 | + expect(info.maxTokens).toBe(131_072) |
| 48 | + expect(info.contextWindow).toBe(1_048_576) |
| 49 | + expect(info.supportsImages).toBe(true) |
| 50 | + expect(info.supportsPromptCache).toBe(true) |
| 51 | + expect(info.supportsReasoningEffort).toEqual(["low", "high", "max"]) |
| 52 | + expect(info.reasoningEffort).toBe("max") |
| 53 | + expect(info.preserveReasoning).toBe(true) |
| 54 | + expect(info.defaultTemperature).toBe(1.0) |
| 55 | + expect(info.inputPrice).toBe(3.0) |
| 56 | + expect(info.outputPrice).toBe(15.0) |
| 57 | + expect(info.cacheWritesPrice).toBe(0) |
| 58 | + expect(info.cacheReadsPrice).toBe(0.3) |
| 59 | + }) |
| 60 | + }) |
| 61 | + |
| 62 | + describe("defaults", () => { |
| 63 | + it("the default model id is a curated registry entry", () => { |
| 64 | + expect(moonshotDefaultModelId).toBe("kimi-k2-0905-preview") |
| 65 | + expect(moonshotModels[moonshotDefaultModelId]).toBeDefined() |
| 66 | + }) |
| 67 | + |
| 68 | + it("exposes a deterministic default temperature", () => { |
| 69 | + expect(MOONSHOT_DEFAULT_TEMPERATURE).toBe(0.6) |
| 70 | + }) |
| 71 | + }) |
| 72 | +}) |
0 commit comments