diff --git a/packages/llm-info/README.md b/packages/llm-info/README.md index 068a1d24a..8be4214bf 100644 --- a/packages/llm-info/README.md +++ b/packages/llm-info/README.md @@ -1,3 +1,32 @@ # @continuedev/llm-info -A lightweight package providing information about various Large Language Models (LLMs). +A lightweight package providing information about various Large Language Models (LLMs), including embedding, reranking, and other models. + +Whereas @continuedev/openai-adapters is responsible for translation between API types, @continuedev/llm-info is concerned with + +- Templates +- Capabilities (e.g. tools, images, streaming, predicted outputs, etc.) +- Model aliases + +and openai-adapters might depend on llm-info for some of these things. + +### Goal + +We know we are done when the steps required to add support for a new model in Continue are exactly + +1. editing a single LlmInfo object, and +2. adding it to the supporting ModelProviders. + +### Code structure + +The two primary types are LlmInfo and ModelProvider + +Models are defined on their own in the `models` directory. They can be grouped however makes sense. + +Providers are defined in the `providers` directory, with all models that they support in their `models` attribute. It's important that models are tied to providers, because the model might have slightly different attributes (e.g. context length) per provider. Define as much as possible in the base object, and then spread to update for the specific providers as needed. + +### Where to use llm-info + +- Replace autodetect.ts +- See usage in `BaseLLM` constructor, and finish the job of using llm-info everywhere relevant. +- Replace `gui/pages/AddNewModel/configs/[providers/models].ts` diff --git a/packages/llm-info/src/types.ts b/packages/llm-info/src/types.ts index 0440b6a4b..d96234a35 100644 --- a/packages/llm-info/src/types.ts +++ b/packages/llm-info/src/types.ts @@ -11,14 +11,20 @@ export interface Parameter { defaultValue?: any; } +export enum ChatTemplate { + None = "none", + // TODO +} + export interface LlmInfo { model: string; - provider: string; + // providers: string[]; // TODO: uncomment and deal with the consequences displayName?: string; description?: string; contextLength?: number; maxCompletionTokens?: number; regex?: RegExp; + chatTemplate?: ChatTemplate; /** If not set, assumes "text" only */ mediaTypes?: MediaType[]; @@ -52,12 +58,17 @@ export interface ApiProviderInfo { handlesTemplating: boolean; } -export type ModelProviderCapability = "stream" | "fim" | "image"; +export type ModelProviderCapability = + | "stream" + | "fim" + | "image" + | "template_chat" + | "tools"; export interface ModelProvider { id: string; displayName: string; - // capabilities: ModelProviderCapability[]; + // capabilities: ModelProviderCapability[]; // TODO: uncomment and deal with the consequences models: Omit[]; /** Any additional parameters required to configure the model