Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface LiteLLMModelInfo {
supports_max_reasoning_effort?: boolean | null
supported_openai_params?: string[] | null
supports_vision?: boolean | null
supports_video_input?: boolean | null
modalities?: {
input?: string[] | null
output?: string[] | null
Expand Down
13 changes: 10 additions & 3 deletions src/utils/model-info/litellm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,16 @@ function buildModalities(info: LiteLLMModelInfo): { input: string[]; output: str
if (input || output) {
return { input: input ?? ['text'], output: output ?? ['text'] }
}
// Older LiteLLM deployments do not expose modalities; derive image input from supports_vision.
if (info.supports_vision === true) {
return { input: ['text', 'image'], output: ['text'] }
// Older LiteLLM deployments do not expose modalities; derive inputs from the capability flags.
if (info.supports_vision === true || info.supports_video_input === true) {
return {
input: [
'text',
...(info.supports_vision === true ? ['image'] : []),
...(info.supports_video_input === true ? ['video'] : []),
],
output: ['text'],
}
}
return undefined
}
Expand Down
14 changes: 14 additions & 0 deletions test/litellm-model-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ describe('native LiteLLM enricher', () => {
expect(enrich({ supports_vision: true }).modalities).toEqual({ input: ['text', 'image'], output: ['text'] })
})

it('derives video input from supports_video_input', () => {
expect(enrich({ supports_video_input: true }).modalities).toEqual({ input: ['text', 'video'], output: ['text'] })
})

it('combines vision and video capability flags', () => {
expect(enrich({ supports_vision: true, supports_video_input: true }).modalities)
.toEqual({ input: ['text', 'image', 'video'], output: ['text'] })
})

it('prefers declared modalities over capability flags', () => {
expect(enrich({ modalities: { input: ['text'] }, supports_vision: true, supports_video_input: true }).modalities)
.toEqual({ input: ['text'], output: ['text'] })
})

it('defaults a missing modality side to text', () => {
expect(enrich({ modalities: { input: ['text', 'image'] } }).modalities)
.toEqual({ input: ['text', 'image'], output: ['text'] })
Expand Down
Loading