-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathminimax.test.ts
More file actions
85 lines (76 loc) · 3.12 KB
/
minimax.test.ts
File metadata and controls
85 lines (76 loc) · 3.12 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
import { describe, test, beforeEach } from "node:test"
import assert from "node:assert/strict"
import { parseModelIdentifier } from "./models"
import { MODEL_PROVIDER_MINIMAX, MINIMAX_API_BASE } from "./constants"
import { defaultModelConfigurations } from "./llms"
import { TestHost } from "./testhost"
import { resolveLanguageModel } from "./lm"
describe("MiniMax provider", () => {
beforeEach(async () => {
TestHost.install()
})
describe("parseModelIdentifier", () => {
test("minimax:MiniMax-M2.7", () => {
const { provider, model, family } =
parseModelIdentifier("minimax:MiniMax-M2.7")
assert.equal(provider, MODEL_PROVIDER_MINIMAX)
assert.equal(model, "MiniMax-M2.7")
assert.equal(family, "MiniMax-M2.7")
})
test("minimax:MiniMax-M2.7-highspeed", () => {
const { provider, model, family } = parseModelIdentifier(
"minimax:MiniMax-M2.7-highspeed"
)
assert.equal(provider, MODEL_PROVIDER_MINIMAX)
assert.equal(model, "MiniMax-M2.7-highspeed")
assert.equal(family, "MiniMax-M2.7-highspeed")
})
test("minimax:MiniMax-M2.5", () => {
const { provider, model, family } =
parseModelIdentifier("minimax:MiniMax-M2.5")
assert.equal(provider, MODEL_PROVIDER_MINIMAX)
assert.equal(model, "MiniMax-M2.5")
assert.equal(family, "MiniMax-M2.5")
})
})
describe("constants", () => {
test("MODEL_PROVIDER_MINIMAX is defined", () => {
assert.equal(MODEL_PROVIDER_MINIMAX, "minimax")
})
test("MINIMAX_API_BASE is correct", () => {
assert.equal(MINIMAX_API_BASE, "https://api.minimax.io/v1")
})
})
describe("llms.json configuration", () => {
test("minimax provider is registered", () => {
const configs = defaultModelConfigurations()
assert(configs)
// minimax should contribute aliases for large and small
const largeConfig = configs.large
assert(largeConfig)
assert(largeConfig.candidates)
const hasMinimax = largeConfig.candidates.some((c: string) =>
c.startsWith("minimax:")
)
assert(hasMinimax, "minimax should be in large candidates")
})
test("minimax small alias is registered", () => {
const configs = defaultModelConfigurations()
const smallConfig = configs.small
assert(smallConfig)
assert(smallConfig.candidates)
const hasMinimax = smallConfig.candidates.some((c: string) =>
c.startsWith("minimax:")
)
assert(hasMinimax, "minimax should be in small candidates")
})
})
describe("resolveLanguageModel", () => {
test("minimax resolves to OpenAI-compatible model", () => {
const lm = resolveLanguageModel(MODEL_PROVIDER_MINIMAX)
assert(lm)
assert(lm.completer)
assert.equal(lm.id, MODEL_PROVIDER_MINIMAX)
})
})
})