Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2import { catalogRowToMeta } from './llmgateway'
3
4const minimax = {
5 id: 'minimax-m3.1-flash',
6 architecture: {
7 input_modalities: ['text', 'image'],
8 output_modalities: ['text'],
9 },
10 context_length: 1048576,
11 max_output: 524288,
12 json_output: false,
13 structured_outputs: false,
14 providers: [
15 {
16 tools: true,
17 reasoning: true,
18 vision: true,
19 streaming: true,
20 reasoning_efforts: ['low', 'medium', 'high', 'xhigh', 'max'],
21 },
22 ],
23}
24
25describe('LLM Gateway catalog rows', () => {
26 it('maps reasoning efforts for a chat row', () => {
27 const meta = catalogRowToMeta(minimax)
28 expect(meta?.reasoning).toEqual({
29 levels: {
30 low: 'low',
31 medium: 'medium',
32 high: 'high',
33 xhigh: 'xhigh',
34 max: 'max',
35 },
36 budget: false,
37 })
38 expect(meta?.contextWindow).toBe(1048576)
39 expect(meta?.maxCompletionTokens).toBe(524288)
40 expect(meta?.features).toContain('tools')
41 expect(meta?.features).toContain('reasoning')
42 })
43
44 it('maps none to the off level', () => {
45 const meta = catalogRowToMeta({
46 ...minimax,
47 id: 'gpt-5.6-terra',
48 providers: [
49 {
50 reasoning: true,
51 reasoning_efforts: ['none', 'low', 'medium', 'high'],
52 },
53 ],
54 })
55 expect(meta?.reasoning?.levels).toEqual({
56 off: 'none',
57 low: 'low',
58 medium: 'medium',
59 high: 'high',
60 })
61 })
62
63 it('skips the custom row and provider-prefixed ids', () => {
64 expect(catalogRowToMeta({ id: 'custom' })).toBeNull()
65 expect(catalogRowToMeta({ id: 'openai/gpt-5.5' })).toBeNull()
66 expect(catalogRowToMeta({ id: '' })).toBeNull()
67 })
68})