68 lines
2.2 KiB
TypeScript
68 lines
2.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
estimateImportedModelVisionTokens,
|
|
getImportedModelProfile,
|
|
} from '../../shared/imported-model-profile';
|
|
import {
|
|
getKnownModelCapabilityKind,
|
|
getModelCapabilityLabel,
|
|
isKnownImageInputModelId,
|
|
} from '../../shared/model-capabilities';
|
|
|
|
describe('getImportedModelProfile', () => {
|
|
it.each([
|
|
'qwen3.6-plus',
|
|
'qwen3.6-plus-2026-04-02',
|
|
'qwen3.7-plus',
|
|
'qwen3.7-plus-2026-05-26',
|
|
])('returns verified limits for %s', (modelId) => {
|
|
expect(getImportedModelProfile(modelId)).toEqual({
|
|
modalities: {
|
|
input: ['text', 'image'],
|
|
output: ['text'],
|
|
},
|
|
limit: {
|
|
context: 1_000_000,
|
|
output: 65_536,
|
|
},
|
|
visionTokenEstimator: 'qwen-32px-grid',
|
|
});
|
|
});
|
|
|
|
it.each(['qwen-vl-max', 'qwen2.5-vl-72b-instruct', 'qwen-omni-turbo'])(
|
|
'keeps image modalities without guessed limits for %s',
|
|
(modelId) => {
|
|
const profile = getImportedModelProfile(modelId);
|
|
expect(profile?.modalities.input).toEqual(['text', 'image']);
|
|
expect(profile).not.toHaveProperty('limit');
|
|
expect(profile).not.toHaveProperty('visionTokenEstimator');
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
'qwen3.8-plus',
|
|
'qwen3.7-plus-latest',
|
|
'qwen3.7-plus-2026-06-15',
|
|
'qwen3.6-plus-2026-04-03',
|
|
'qwen3.7-plus-2026-99-99',
|
|
'deepseek-chat',
|
|
'',
|
|
])('does not guess metadata for %s', (modelId) => {
|
|
expect(getImportedModelProfile(modelId)).toBeNull();
|
|
});
|
|
|
|
it('estimates only profiles with the verified Qwen grid formula', () => {
|
|
expect(estimateImportedModelVisionTokens('qwen3.7-plus', 1930, 1086)).toBe(2049);
|
|
expect(estimateImportedModelVisionTokens('qwen-vl-max', 1930, 1086)).toBeNull();
|
|
});
|
|
|
|
it('keeps the legacy capability helpers delegated to the same profile', () => {
|
|
expect(isKnownImageInputModelId('qwen3.7-plus')).toBe(true);
|
|
expect(isKnownImageInputModelId('deepseek-chat')).toBe(false);
|
|
expect(getKnownModelCapabilityKind('qwen-vl-max')).toBe('multimodal');
|
|
expect(getKnownModelCapabilityKind('deepseek-chat')).toBe('text');
|
|
expect(getModelCapabilityLabel('multimodal')).toBe('多模态');
|
|
expect(getModelCapabilityLabel('text')).toBe('文本');
|
|
});
|
|
});
|