| 1 | export type UseCase = "chat" | "autocomplete" | "rerank" | "embed"; |
| 2 | |
| 3 | export type ParameterType = "string" | "number" | "boolean"; |
| 4 | |
| 5 | export interface Parameter { |
| 6 | key: string; |
| 7 | required: boolean; |
| 8 | valueType: ParameterType; |
| 9 | displayName?: string; |
| 10 | description?: string; |
| 11 | defaultValue?: any; |
| 12 | } |
| 13 | |
| 14 | export enum ChatTemplate { |
| 15 | None = "none", |
| 16 | // TODO |
| 17 | } |
| 18 | |
| 19 | export interface LlmInfo { |
| 20 | model: string; |
| 21 | // providers: string[]; // TODO: uncomment and deal with the consequences |
| 22 | displayName?: string; |
| 23 | description?: string; |
| 24 | contextLength?: number; |
| 25 | maxCompletionTokens?: number; |
| 26 | regex?: RegExp; |
| 27 | chatTemplate?: ChatTemplate; |
| 28 | |
| 29 | /** If not set, assumes "text" only */ |
| 30 | mediaTypes?: MediaType[]; |
| 31 | recommendedFor?: UseCase[]; |
| 32 | |
| 33 | /** Any additional parameters required to configure the model */ |
| 34 | extraParameters?: Parameter[]; |
| 35 | } |
| 36 | |
| 37 | export type LlmInfoWithProvider = LlmInfo & { |
| 38 | provider: string; |
| 39 | }; |
| 40 | |
| 41 | export enum MediaType { |
| 42 | Text = "text", |
| 43 | Image = "image", |
| 44 | Audio = "audio", |
| 45 | Video = "video", |
| 46 | } |
| 47 | |
| 48 | export const AllMediaTypes = [ |
| 49 | MediaType.Text, |
| 50 | MediaType.Image, |
| 51 | MediaType.Audio, |
| 52 | MediaType.Video, |
| 53 | ]; |
| 54 | |
| 55 | export interface ApiProviderInfo { |
| 56 | displayName: string; |
| 57 | supportsStreaming: boolean; |
| 58 | handlesTemplating: boolean; |
| 59 | } |
| 60 | |
| 61 | export type ModelProviderCapability = |
| 62 | | "stream" |
| 63 | | "fim" |
| 64 | | "image" |
| 65 | | "template_chat" |
| 66 | | "tools"; |
| 67 | |
| 68 | export interface ModelProvider { |
| 69 | id: string; |
| 70 | displayName: string; |
| 71 | // capabilities: ModelProviderCapability[]; // TODO: uncomment and deal with the consequences |
| 72 | models: Omit<LlmInfo, "provider">[]; |
| 73 | |
| 74 | /** Any additional parameters required to configure the model |
| 75 | * |
| 76 | * (other than apiKey, apiBase, which are assumed always. And of course model and provider always required) |
| 77 | */ |
| 78 | extraParameters?: Parameter[]; |
| 79 | } |