diff --git a/packages/llm-info/package.json b/packages/llm-info/package.json index 2473603ff..6045d089c 100644 --- a/packages/llm-info/package.json +++ b/packages/llm-info/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/llm-info", - "version": "1.0.4", + "version": "1.0.5", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/llm-info/src/index.ts b/packages/llm-info/src/index.ts index f84213256..3c0ae9f34 100644 --- a/packages/llm-info/src/index.ts +++ b/packages/llm-info/src/index.ts @@ -1,28 +1,32 @@ -import { AnthropicLlms } from "./providers/anthropic.js"; -import { AzureLlms } from "./providers/azure.js"; -import { BedrockLlms } from "./providers/bedrock.js"; -import { CohereLlms } from "./providers/cohere.js"; -import { GeminiLlms } from "./providers/gemini.js"; -import { MistralLlms } from "./providers/mistral.js"; -import { OllamaLlms } from "./providers/ollama.js"; -import { OpenAiLlms } from "./providers/openai.js"; -import { vllmLlms } from "./providers/vllm.js"; -import { VoyageLlms } from "./providers/voyage.js"; -import { LlmInfo, UseCase } from "./types.js"; +import { Anthropic } from "./providers/anthropic.js"; +import { Azure } from "./providers/azure.js"; +import { Bedrock } from "./providers/bedrock.js"; +import { Cohere } from "./providers/cohere.js"; +import { Gemini } from "./providers/gemini.js"; +import { Mistral } from "./providers/mistral.js"; +import { Ollama } from "./providers/ollama.js"; +import { OpenAi } from "./providers/openai.js"; +import { Vllm } from "./providers/vllm.js"; +import { Voyage } from "./providers/voyage.js"; +import { LlmInfo, ModelProvider, UseCase } from "./types.js"; -export const allLlms: LlmInfo[] = [ - ...OpenAiLlms, - ...GeminiLlms, - ...AnthropicLlms, - ...MistralLlms, - ...VoyageLlms, - ...AzureLlms, - ...OllamaLlms, - ...vllmLlms, - ...BedrockLlms, - ...CohereLlms, +export const allModelProviders: ModelProvider[] = [ + OpenAi, + Gemini, + Anthropic, + Mistral, + Voyage, + Azure, + Ollama, + Vllm, + Bedrock, + Cohere, ]; +export const allLlms: LlmInfo[] = allModelProviders.flatMap((provider) => + provider.models.map((model) => ({ ...model, provider: provider.id })), +); + export function findLlmInfo(model: string): LlmInfo | undefined { return allLlms.find((llm) => llm.regex ? llm.regex.test(model) : llm.model === model, diff --git a/packages/llm-info/src/providers/anthropic.ts b/packages/llm-info/src/providers/anthropic.ts index 6bd60b62c..bc4aa92d9 100644 --- a/packages/llm-info/src/providers/anthropic.ts +++ b/packages/llm-info/src/providers/anthropic.ts @@ -1,68 +1,72 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; -export const AnthropicLlms = llms("anthropic", [ - { - model: "claude-3-5-sonnet-20240620", - displayName: "Claude 3.5 Sonnet", - contextLength: 200_000, - maxCompletionTokens: 8192, - description: - "Most intelligent model with the highest level of intelligence and capability.", - regex: /claude-3\.5-sonnet/i, - recommendedFor: ["chat"], - }, - { - model: "claude-3-opus-20240229", - displayName: "Claude 3 Opus", - contextLength: 200_000, - maxCompletionTokens: 4096, - description: - "Powerful model for highly complex tasks with top-level performance, intelligence, fluency, and understanding.", - regex: /claude-3-opus/i, - }, - { - model: "claude-3-sonnet-20240229", - displayName: "Claude 3 Sonnet", - contextLength: 200_000, - maxCompletionTokens: 4096, - description: - "Balance of intelligence and speed with strong utility, balanced for scaled deployments.", - regex: /claude-3-sonnet/i, - }, - { - model: "claude-3-haiku-20240307", - displayName: "Claude 3 Haiku", - contextLength: 200_000, - maxCompletionTokens: 4096, - description: - "Fastest and most compact model for near-instant responsiveness with quick and accurate targeted performance.", - regex: /claude-3-haiku/i, - }, - { - model: "claude-2.1", - displayName: "Claude 2.1", - contextLength: 200_000, - maxCompletionTokens: 4096, - description: - "Updated version of Claude 2 with improved accuracy and consistency.", - regex: /claude-2\.1/i, - }, - { - model: "claude-2.0", - displayName: "Claude 2", - contextLength: 100_000, - maxCompletionTokens: 4096, - description: - "Predecessor to Claude 3, offering strong all-round performance.", - regex: /claude-2\.0/i, - }, - { - model: "claude-instant-1.2", - displayName: "Claude Instant 1.2", - contextLength: 100_000, - maxCompletionTokens: 4096, - description: - "Our cheapest small and fast model, a predecessor of Claude Haiku.", - regex: /claude-instant-1\.2/i, - }, -]); +export const Anthropic: ModelProvider = { + id: "anthropic", + displayName: "Anthropic", + models: [ + { + model: "claude-3-5-sonnet-20240620", + displayName: "Claude 3.5 Sonnet", + contextLength: 200000, + maxCompletionTokens: 8192, + description: + "Most intelligent model with the highest level of intelligence and capability.", + regex: /claude-3\.5-sonnet/i, + recommendedFor: ["chat"], + }, + { + model: "claude-3-opus-20240229", + displayName: "Claude 3 Opus", + contextLength: 200000, + maxCompletionTokens: 4096, + description: + "Powerful model for highly complex tasks with top-level performance, intelligence, fluency, and understanding.", + regex: /claude-3-opus/i, + }, + { + model: "claude-3-sonnet-20240229", + displayName: "Claude 3 Sonnet", + contextLength: 200000, + maxCompletionTokens: 4096, + description: + "Balance of intelligence and speed with strong utility, balanced for scaled deployments.", + regex: /claude-3-sonnet/i, + }, + { + model: "claude-3-haiku-20240307", + displayName: "Claude 3 Haiku", + contextLength: 200000, + maxCompletionTokens: 4096, + description: + "Fastest and most compact model for near-instant responsiveness with quick and accurate targeted performance.", + regex: /claude-3-haiku/i, + }, + { + model: "claude-2.1", + displayName: "Claude 2.1", + contextLength: 200000, + maxCompletionTokens: 4096, + description: + "Updated version of Claude 2 with improved accuracy and consistency.", + regex: /claude-2\.1/i, + }, + { + model: "claude-2.0", + displayName: "Claude 2", + contextLength: 100000, + maxCompletionTokens: 4096, + description: + "Predecessor to Claude 3, offering strong all-round performance.", + regex: /claude-2\.0/i, + }, + { + model: "claude-instant-1.2", + displayName: "Claude Instant 1.2", + contextLength: 100000, + maxCompletionTokens: 4096, + description: + "Our cheapest small and fast model, a predecessor of Claude Haiku.", + regex: /claude-instant-1\.2/i, + }, + ], +}; diff --git a/packages/llm-info/src/providers/azure.ts b/packages/llm-info/src/providers/azure.ts index 442e9ab1b..55d32abab 100644 --- a/packages/llm-info/src/providers/azure.ts +++ b/packages/llm-info/src/providers/azure.ts @@ -1,16 +1,21 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; -export const AzureLlms = llms("azure", [ - { - model: "gpt-4o", - displayName: "GPT-4o", - contextLength: 128_000, - recommendedFor: ["chat"], - }, - { - model: "gpt-4o-mini", - displayName: "GPT-4o Mini", - contextLength: 128_000, - recommendedFor: ["chat"], - }, -]); +export const Azure: ModelProvider = { + id: "azure", + displayName: "Azure", + extraParameters: [], + models: [ + { + model: "gpt-4o", + displayName: "GPT-4o", + contextLength: 128_000, + recommendedFor: ["chat"], + }, + { + model: "gpt-4o-mini", + displayName: "GPT-4o Mini", + contextLength: 128_000, + recommendedFor: ["chat"], + }, + ], +}; diff --git a/packages/llm-info/src/providers/bedrock.ts b/packages/llm-info/src/providers/bedrock.ts index e2a6551fa..122e41306 100644 --- a/packages/llm-info/src/providers/bedrock.ts +++ b/packages/llm-info/src/providers/bedrock.ts @@ -1,22 +1,26 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; -export const BedrockLlms = llms("bedrock", [ - { - model: "anthropic.claude-3-5-sonnet-20240620-v1:0", - displayName: "Claude 3.5 Sonnet", - contextLength: 200_000, - maxCompletionTokens: 8192, - }, - { - model: "meta.llama3-1-405b-instruct-v1:0", - displayName: "Llama 3.1 405B", - }, - { - model: "meta.llama3-2-90b-instruct-v1:0", - displayName: "Llama 3.2 90B", - }, - { - model: "mistral.mistral-large-2407-v1:0", - displayName: "Mistral Large 2", - }, -]); +export const Bedrock: ModelProvider = { + models: [ + { + model: "anthropic.claude-3-5-sonnet-20240620-v1:0", + displayName: "Claude 3.5 Sonnet", + contextLength: 200000, + maxCompletionTokens: 8192, + }, + { + model: "meta.llama3-1-405b-instruct-v1:0", + displayName: "Llama 3.1 405B", + }, + { + model: "meta.llama3-2-90b-instruct-v1:0", + displayName: "Llama 3.2 90B", + }, + { + model: "mistral.mistral-large-2407-v1:0", + displayName: "Mistral Large 2", + }, + ], + id: "bedrock", + displayName: "Bedrock", +}; diff --git a/packages/llm-info/src/providers/cohere.ts b/packages/llm-info/src/providers/cohere.ts index 203435488..edbaed4a7 100644 --- a/packages/llm-info/src/providers/cohere.ts +++ b/packages/llm-info/src/providers/cohere.ts @@ -1,29 +1,33 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; -export const CohereLlms = llms("cohere", [ - { - model: "command-r-plus", - displayName: "Command R+", - contextLength: 128_000, - maxCompletionTokens: 4_000, - // recommendedFor: ["chat"], - }, - { - model: "command-r", - displayName: "Command R", - contextLength: 128_000, - maxCompletionTokens: 4_000, - }, - { - model: "embed-english-v3.0", - displayName: "Embed English 3.0", - // recommendedFor: ["embed"], - contextLength: 512, - }, - { - model: "rerank-english-v3.0", - displayName: "Rerank English 3.0", - // recommendedFor: ["rerank"], - contextLength: 4_000, - }, -]); +export const Cohere: ModelProvider = { + models: [ + { + model: "command-r-plus", + displayName: "Command R+", + contextLength: 128000, + maxCompletionTokens: 4000, + // recommendedFor: ["chat"], + }, + { + model: "command-r", + displayName: "Command R", + contextLength: 128000, + maxCompletionTokens: 4000, + }, + { + model: "embed-english-v3.0", + displayName: "Embed English 3.0", + // recommendedFor: ["embed"], + contextLength: 512, + }, + { + model: "rerank-english-v3.0", + displayName: "Rerank English 3.0", + // recommendedFor: ["rerank"], + contextLength: 4000, + }, + ], + id: "cohere", + displayName: "Cohere", +}; diff --git a/packages/llm-info/src/providers/gemini.ts b/packages/llm-info/src/providers/gemini.ts index 6afc43b15..3529f37a4 100644 --- a/packages/llm-info/src/providers/gemini.ts +++ b/packages/llm-info/src/providers/gemini.ts @@ -1,33 +1,36 @@ -import { AllMediaTypes } from "../types.js"; -import { llms } from "../util.js"; +import { AllMediaTypes, ModelProvider } from "../types.js"; -export const GeminiLlms = llms("gemini", [ - { - model: "gemini-1.5-flash", - displayName: "Gemini 1.5 Flash", - contextLength: 1_048_576, - maxCompletionTokens: 8192, - mediaTypes: AllMediaTypes, - regex: /gemini-1\.5-flash/i, - recommendedFor: ["chat"], - }, - { - model: "gemini-1.5-pro", - displayName: "Gemini 1.5 Pro", - contextLength: 2_097_152, - maxCompletionTokens: 8192, - regex: /gemini-1\.5-pro/i, - recommendedFor: ["chat"], - }, - { - model: "gemini-1.0-pro", - displayName: "Gemini 1.0 Pro", - regex: /gemini-1\.0-pro/i, - }, - // embed - { - model: "models/text-embedding-004", - displayName: "Gemini Text Embedding", - recommendedFor: ["embed"], - }, -]); +export const Gemini: ModelProvider = { + models: [ + { + model: "gemini-1.5-flash", + displayName: "Gemini 1.5 Flash", + contextLength: 1048576, + maxCompletionTokens: 8192, + mediaTypes: AllMediaTypes, + regex: /gemini-1\.5-flash/i, + recommendedFor: ["chat"], + }, + { + model: "gemini-1.5-pro", + displayName: "Gemini 1.5 Pro", + contextLength: 2097152, + maxCompletionTokens: 8192, + regex: /gemini-1\.5-pro/i, + recommendedFor: ["chat"], + }, + { + model: "gemini-1.0-pro", + displayName: "Gemini 1.0 Pro", + regex: /gemini-1\.0-pro/i, + }, + // embed + { + model: "models/text-embedding-004", + displayName: "Gemini Text Embedding", + recommendedFor: ["embed"], + }, + ], + id: "gemini", + displayName: "Gemini", +}; diff --git a/packages/llm-info/src/providers/mistral.ts b/packages/llm-info/src/providers/mistral.ts index b40b900fe..7d5007d50 100644 --- a/packages/llm-info/src/providers/mistral.ts +++ b/packages/llm-info/src/providers/mistral.ts @@ -1,78 +1,82 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; -export const MistralLlms = llms("mistral", [ - { - model: "mistral-large-latest", - displayName: "Mistral Large", - contextLength: 32768, - description: - "Flagship model ideal for complex tasks requiring large reasoning capabilities or highly specialized tasks like synthetic text generation, code generation, RAG, or agents.", - regex: /mistral-large/i, - recommendedFor: ["chat"], - }, - { - model: "mistral-medium-latest", - displayName: "Mistral Medium", - contextLength: 32768, - description: - "Ideal for intermediate tasks requiring moderate reasoning such as data extraction, document summarization, email writing, job descriptions, or product descriptions. (Note: Will be deprecated in the coming months)", - regex: /mistral-medium/i, - }, - { - model: "mistral-small-latest", - displayName: "Mistral Small", - contextLength: 32768, - description: - "Suitable for simple tasks that can be done in bulk like classification, customer support, or text generation.", - regex: /mistral-small/i, - }, - { - model: "open-mistral-7b", - displayName: "Mistral 7B", - contextLength: 32768, - description: - "First dense model released by Mistral AI, perfect for experimentation, customization, and quick iteration. Matches capabilities of models up to 30B parameters at release time.", - regex: /open-mistral-7b/i, - }, - { - model: "open-mixtral-8x7b", - displayName: "Mixtral 8x7B", - contextLength: 32768, - description: - "Sparse mixture of experts model leveraging up to 45B parameters but using about 12B during inference, offering better inference throughput at the cost of more vRAM.", - regex: /open-mixtral-8x7b/i, - }, - { - model: "open-mixtral-8x22b", - displayName: "Mixtral 8x22B", - contextLength: 65536, - description: - "Larger sparse mixture of experts model leveraging up to 141B parameters but using about 39B during inference, providing better inference throughput at the cost of more vRAM.", - regex: /open-mixtral-8x22b/i, - }, - { - model: "mistral-embed", - displayName: "Mistral Embeddings", - contextLength: 8192, - description: - "Model that converts text into numerical vectors of embeddings in 1024 dimensions. Enables retrieval and retrieval-augmented generation applications with a retrieval score of 55.26 on MTEB.", - regex: /mistral-embed/i, - recommendedFor: ["embed"], - }, - { - model: "codestral-mamba-latest", - displayName: "Codestral Mamba", - contextLength: 256_000, - description: "A Mamba 2 language model specialized in code generation.", - regex: /codestral-mamba/i, - }, - { - model: "codestral-latest", - displayName: "Codestral", - contextLength: 32768, - description: - "Cutting-edge generative model specifically designed and optimized for code generation tasks, including fill-in-the-middle and code completion.", - regex: /codestral/i, - recommendedFor: ["autocomplete"], - }, -]); +export const Mistral: ModelProvider = { + models: [ + { + model: "mistral-large-latest", + displayName: "Mistral Large", + contextLength: 32768, + description: + "Flagship model ideal for complex tasks requiring large reasoning capabilities or highly specialized tasks like synthetic text generation, code generation, RAG, or agents.", + regex: /mistral-large/i, + recommendedFor: ["chat"], + }, + { + model: "mistral-medium-latest", + displayName: "Mistral Medium", + contextLength: 32768, + description: + "Ideal for intermediate tasks requiring moderate reasoning such as data extraction, document summarization, email writing, job descriptions, or product descriptions. (Note: Will be deprecated in the coming months)", + regex: /mistral-medium/i, + }, + { + model: "mistral-small-latest", + displayName: "Mistral Small", + contextLength: 32768, + description: + "Suitable for simple tasks that can be done in bulk like classification, customer support, or text generation.", + regex: /mistral-small/i, + }, + { + model: "open-mistral-7b", + displayName: "Mistral 7B", + contextLength: 32768, + description: + "First dense model released by Mistral AI, perfect for experimentation, customization, and quick iteration. Matches capabilities of models up to 30B parameters at release time.", + regex: /open-mistral-7b/i, + }, + { + model: "open-mixtral-8x7b", + displayName: "Mixtral 8x7B", + contextLength: 32768, + description: + "Sparse mixture of experts model leveraging up to 45B parameters but using about 12B during inference, offering better inference throughput at the cost of more vRAM.", + regex: /open-mixtral-8x7b/i, + }, + { + model: "open-mixtral-8x22b", + displayName: "Mixtral 8x22B", + contextLength: 65536, + description: + "Larger sparse mixture of experts model leveraging up to 141B parameters but using about 39B during inference, providing better inference throughput at the cost of more vRAM.", + regex: /open-mixtral-8x22b/i, + }, + { + model: "mistral-embed", + displayName: "Mistral Embeddings", + contextLength: 8192, + description: + "Model that converts text into numerical vectors of embeddings in 1024 dimensions. Enables retrieval and retrieval-augmented generation applications with a retrieval score of 55.26 on MTEB.", + regex: /mistral-embed/i, + recommendedFor: ["embed"], + }, + { + model: "codestral-mamba-latest", + displayName: "Codestral Mamba", + contextLength: 256000, + description: "A Mamba 2 language model specialized in code generation.", + regex: /codestral-mamba/i, + }, + { + model: "codestral-latest", + displayName: "Codestral", + contextLength: 32768, + description: + "Cutting-edge generative model specifically designed and optimized for code generation tasks, including fill-in-the-middle and code completion.", + regex: /codestral/i, + recommendedFor: ["autocomplete"], + }, + ], + id: "mistral", + displayName: "Mistral", +}; diff --git a/packages/llm-info/src/providers/ollama.ts b/packages/llm-info/src/providers/ollama.ts index 0ba7f3a2b..0d2459e11 100644 --- a/packages/llm-info/src/providers/ollama.ts +++ b/packages/llm-info/src/providers/ollama.ts @@ -1,4 +1,8 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; import { OsLlms } from "./os.js"; -export const OllamaLlms = llms("ollama", OsLlms); +export const Ollama: ModelProvider = { + models: OsLlms, + id: "ollama", + displayName: "Ollama", +}; diff --git a/packages/llm-info/src/providers/openai.ts b/packages/llm-info/src/providers/openai.ts index 1c47cc947..5fd100a8b 100644 --- a/packages/llm-info/src/providers/openai.ts +++ b/packages/llm-info/src/providers/openai.ts @@ -1,113 +1,117 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; -export const OpenAiLlms = llms("openai", [ - { - model: "gpt-3.5-turbo", - displayName: "GPT-3.5 Turbo", - contextLength: 16_385, - maxCompletionTokens: 4096, - }, - { - model: "gpt-3.5-turbo-16k", - displayName: "GPT-3.5 Turbo 16K", - contextLength: 16384, - maxCompletionTokens: 4096, - }, - { - model: "gpt-35-turbo-16k", - displayName: "GPT-3.5 Turbo 16K", - contextLength: 16384, - maxCompletionTokens: 4096, - }, - { - model: "gpt-35-turbo-0613", - displayName: "GPT-3.5 Turbo (0613)", - contextLength: 4096, - maxCompletionTokens: 4096, - }, - { - model: "gpt-35-turbo", - displayName: "GPT-3.5 Turbo", - contextLength: 4096, - maxCompletionTokens: 4096, - }, - // gpt-4 - { - model: "gpt-4", - displayName: "GPT-4", - contextLength: 8192, - maxCompletionTokens: 8192, - }, - { - model: "gpt-4-32k", - displayName: "GPT-4 32K", - contextLength: 32_000, - maxCompletionTokens: 8192, - }, - { - model: "gpt-4-turbo-preview", - displayName: "GPT-4 Turbo Preview", - contextLength: 128_000, - maxCompletionTokens: 4096, - }, - { - model: "gpt-4-vision", - displayName: "GPT-4 Vision", - contextLength: 128_000, - maxCompletionTokens: 4096, - }, - { - model: "gpt-4-0125-preview", - displayName: "GPT-4 (0125 Preview)", - contextLength: 128_000, - maxCompletionTokens: 4096, - }, - { - model: "gpt-4-1106-preview", - displayName: "GPT-4 (1106 Preview)", - contextLength: 128_000, - maxCompletionTokens: 4096, - }, - // gpt-4o - { - model: "gpt-4o", - displayName: "GPT-4o", - contextLength: 128_000, - recommendedFor: ["chat"], - }, - { - model: "gpt-4o-mini", - displayName: "GPT-4o Mini", - contextLength: 128_000, - recommendedFor: ["chat"], - }, - // o1 - { - model: "o1-preview", - displayName: "o1 Preview", - contextLength: 128_000, - maxCompletionTokens: 32_768, - recommendedFor: ["chat"], - }, - { - model: "o1-mini", - displayName: "o1 Mini", - contextLength: 128_000, - maxCompletionTokens: 65_536, - recommendedFor: ["chat"], - }, - // embed - { - model: "text-embedding-3-large", - displayName: "Text Embedding 3-Large", - recommendedFor: ["embed"], - }, - { - model: "text-embedding-3-small", - displayName: "Text Embedding 3-Small", - }, - { - model: "text-embedding-ada-002", - displayName: "Text Embedding Ada-002", - }, -]); +export const OpenAi: ModelProvider = { + models: [ + { + model: "gpt-3.5-turbo", + displayName: "GPT-3.5 Turbo", + contextLength: 16385, + maxCompletionTokens: 4096, + }, + { + model: "gpt-3.5-turbo-16k", + displayName: "GPT-3.5 Turbo 16K", + contextLength: 16384, + maxCompletionTokens: 4096, + }, + { + model: "gpt-35-turbo-16k", + displayName: "GPT-3.5 Turbo 16K", + contextLength: 16384, + maxCompletionTokens: 4096, + }, + { + model: "gpt-35-turbo-0613", + displayName: "GPT-3.5 Turbo (0613)", + contextLength: 4096, + maxCompletionTokens: 4096, + }, + { + model: "gpt-35-turbo", + displayName: "GPT-3.5 Turbo", + contextLength: 4096, + maxCompletionTokens: 4096, + }, + // gpt-4 + { + model: "gpt-4", + displayName: "GPT-4", + contextLength: 8192, + maxCompletionTokens: 8192, + }, + { + model: "gpt-4-32k", + displayName: "GPT-4 32K", + contextLength: 32000, + maxCompletionTokens: 8192, + }, + { + model: "gpt-4-turbo-preview", + displayName: "GPT-4 Turbo Preview", + contextLength: 128000, + maxCompletionTokens: 4096, + }, + { + model: "gpt-4-vision", + displayName: "GPT-4 Vision", + contextLength: 128000, + maxCompletionTokens: 4096, + }, + { + model: "gpt-4-0125-preview", + displayName: "GPT-4 (0125 Preview)", + contextLength: 128000, + maxCompletionTokens: 4096, + }, + { + model: "gpt-4-1106-preview", + displayName: "GPT-4 (1106 Preview)", + contextLength: 128000, + maxCompletionTokens: 4096, + }, + // gpt-4o + { + model: "gpt-4o", + displayName: "GPT-4o", + contextLength: 128000, + recommendedFor: ["chat"], + }, + { + model: "gpt-4o-mini", + displayName: "GPT-4o Mini", + contextLength: 128000, + recommendedFor: ["chat"], + }, + // o1 + { + model: "o1-preview", + displayName: "o1 Preview", + contextLength: 128000, + maxCompletionTokens: 32768, + recommendedFor: ["chat"], + }, + { + model: "o1-mini", + displayName: "o1 Mini", + contextLength: 128000, + maxCompletionTokens: 65536, + recommendedFor: ["chat"], + }, + // embed + { + model: "text-embedding-3-large", + displayName: "Text Embedding 3-Large", + recommendedFor: ["embed"], + }, + { + model: "text-embedding-3-small", + displayName: "Text Embedding 3-Small", + }, + { + model: "text-embedding-ada-002", + displayName: "Text Embedding Ada-002", + }, + ], + id: "openai", + displayName: "OpenAI", +}; diff --git a/packages/llm-info/src/providers/vllm.ts b/packages/llm-info/src/providers/vllm.ts index 906b2061a..0ff443518 100644 --- a/packages/llm-info/src/providers/vllm.ts +++ b/packages/llm-info/src/providers/vllm.ts @@ -1,4 +1,8 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; import { OsLlms } from "./os.js"; -export const vllmLlms = llms("vllm", OsLlms); +export const Vllm: ModelProvider = { + models: OsLlms, + id: "vllm", + displayName: "vLLM", +}; diff --git a/packages/llm-info/src/providers/voyage.ts b/packages/llm-info/src/providers/voyage.ts index b68519cea..9bc5f6250 100644 --- a/packages/llm-info/src/providers/voyage.ts +++ b/packages/llm-info/src/providers/voyage.ts @@ -1,26 +1,30 @@ -import { llms } from "../util.js"; +import { ModelProvider } from "../types.js"; -export const VoyageLlms = llms("voyage", [ - { - model: "voyage-code-2", - displayName: "Voyage Code 2", - contextLength: 8096, - recommendedFor: ["embed"], - }, - { - model: "rerank-2", - displayName: "Rerank 2", - contextLength: 8096, - recommendedFor: ["rerank"], - }, - { - model: "rerank-2-lite", - displayName: "Rerank 2 Lite", - contextLength: 8096, - }, - { - model: "rerank-lite-1", - displayName: "Rerank Lite 1", - contextLength: 8096, - }, -]); +export const Voyage: ModelProvider = { + models: [ + { + model: "voyage-code-2", + displayName: "Voyage Code 2", + contextLength: 8096, + recommendedFor: ["embed"], + }, + { + model: "rerank-2", + displayName: "Rerank 2", + contextLength: 8096, + recommendedFor: ["rerank"], + }, + { + model: "rerank-2-lite", + displayName: "Rerank 2 Lite", + contextLength: 8096, + }, + { + model: "rerank-lite-1", + displayName: "Rerank Lite 1", + contextLength: 8096, + }, + ], + id: "voyage", + displayName: "Voyage", +}; diff --git a/packages/llm-info/src/types.ts b/packages/llm-info/src/types.ts index f60b1fce0..0440b6a4b 100644 --- a/packages/llm-info/src/types.ts +++ b/packages/llm-info/src/types.ts @@ -51,3 +51,18 @@ export interface ApiProviderInfo { supportsStreaming: boolean; handlesTemplating: boolean; } + +export type ModelProviderCapability = "stream" | "fim" | "image"; + +export interface ModelProvider { + id: string; + displayName: string; + // capabilities: ModelProviderCapability[]; + models: Omit[]; + + /** Any additional parameters required to configure the model + * + * (other than apiKey, apiBase, which are assumed always. And of course model and provider always required) + */ + extraParameters?: Parameter[]; +}