Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2import { OpenAITextAdapter } from '../src/adapters/text'
3import { OpenAIChatCompletionsTextAdapter } from '../src/adapters/text-chat-completions'
4
5// Constructing the SDK client makes no network call.
6const config = { apiKey: 'sk-test' }
7
8describe('OpenAI text adapter inputModalities', () => {
9 it('gives the input list of each known model', () => {
10 expect(new OpenAITextAdapter(config, 'gpt-5.2').inputModalities).toEqual([
11 'text',
12 'image',
13 'document',
14 ])
15 expect(new OpenAITextAdapter(config, 'gpt-audio').inputModalities).toEqual([
16 'text',
17 'audio',
18 ])
19 })
20
21 it('is undefined for a model the metadata does not list', () => {
22 // A JS caller, or a model id newer than this package, reaches the adapter.
23 // @ts-expect-error - 'gpt-unknown-9000' is not a declared model
24 const adapter = new OpenAITextAdapter(config, 'gpt-unknown-9000')
25
26 expect(adapter.inputModalities).toBeUndefined()
27 })
28
29 it('gives the same list on the Chat Completions adapter', () => {
30 const adapter = new OpenAIChatCompletionsTextAdapter(config, 'gpt-audio')
31
32 expect(adapter.inputModalities).toEqual(['text', 'audio'])
33 })
34})