update llm-info package

This commit is contained in:
Nate 2024-10-13 20:09:36 -07:00
parent 1c75d9b2c5
commit abb6e3ec09
15 changed files with 207 additions and 16 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@continuedev/llm-info",
"version": "1.0.2",
"version": "1.0.3",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,14 +1,26 @@
import { AnthropicLlms } from "./models/anthropic.js";
import { GoogleLlms } from "./models/google.js";
import { AzureLlms } from "./models/azure.js";
import { BedrockLlms } from "./models/bedrock.js";
import { CohereLlms } from "./models/cohere.js";
import { GeminiLlms } from "./models/gemini.js";
import { MistralLlms } from "./models/mistral.js";
import { OllamaLlms } from "./models/ollama.js";
import { OpenAiLlms } from "./models/openai.js";
import { LlmInfo } from "./types.js";
import { vllmLlms } from "./models/vllm.js";
import { VoyageLlms } from "./models/voyage.js";
import { LlmInfo, UseCase } from "./types.js";
export const allLlms: LlmInfo[] = [
...OpenAiLlms,
...GoogleLlms,
...GeminiLlms,
...AnthropicLlms,
...MistralLlms,
...VoyageLlms,
...AzureLlms,
...OllamaLlms,
...vllmLlms,
...BedrockLlms,
...CohereLlms,
];
export function findLlmInfo(model: string): LlmInfo | undefined {
@ -16,3 +28,7 @@ export function findLlmInfo(model: string): LlmInfo | undefined {
llm.regex ? llm.regex.test(model) : llm.model === model,
);
}
export function getAllRecommendedFor(useCase: UseCase): LlmInfo[] {
return allLlms.filter((llm) => llm.recommendedFor?.includes(useCase));
}

View file

@ -1,6 +1,6 @@
import { LlmInfo } from "../types.js";
import { llms } from "../util.js";
export const AnthropicLlms: LlmInfo[] = [
export const AnthropicLlms = llms("anthropic", [
{
model: "claude-3-5-sonnet-20240620",
displayName: "Claude 3.5 Sonnet",
@ -9,6 +9,7 @@ export const AnthropicLlms: LlmInfo[] = [
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",
@ -64,4 +65,4 @@ export const AnthropicLlms: LlmInfo[] = [
"Our cheapest small and fast model, a predecessor of Claude Haiku.",
regex: /claude-instant-1\.2/i,
},
];
]);

View file

@ -0,0 +1,16 @@
import { llms } from "../util.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"],
},
]);

View file

@ -0,0 +1,22 @@
import { llms } from "../util.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",
},
]);

View file

@ -0,0 +1,29 @@
import { llms } from "../util.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,
},
]);

View file

@ -1,6 +1,7 @@
import { AllMediaTypes, LlmInfo } from "../types.js";
import { AllMediaTypes } from "../types.js";
import { llms } from "../util.js";
export const GoogleLlms: LlmInfo[] = [
export const GeminiLlms = llms("gemini", [
{
model: "gemini-1.5-flash",
displayName: "Gemini 1.5 Flash",
@ -8,6 +9,7 @@ export const GoogleLlms: LlmInfo[] = [
maxCompletionTokens: 8192,
mediaTypes: AllMediaTypes,
regex: /gemini-1\.5-flash/i,
recommendedFor: ["chat"],
},
{
model: "gemini-1.5-pro",
@ -15,10 +17,17 @@ export const GoogleLlms: LlmInfo[] = [
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"],
},
]);

View file

@ -1,6 +1,6 @@
import { LlmInfo } from "../types.js";
import { llms } from "../util.js";
export const MistralLlms: LlmInfo[] = [
export const MistralLlms = llms("mistral", [
{
model: "mistral-large-latest",
displayName: "Mistral Large",
@ -8,6 +8,7 @@ export const MistralLlms: LlmInfo[] = [
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",
@ -56,6 +57,7 @@ export const MistralLlms: LlmInfo[] = [
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",
@ -71,5 +73,12 @@ export const MistralLlms: LlmInfo[] = [
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"],
},
];
// embed
{
model: "mistral-embed",
displayName: "Mistral Embed",
recommendedFor: ["embed"],
},
]);

View file

@ -0,0 +1,4 @@
import { llms } from "../util.js";
import { OsLlms } from "./os.js";
export const OllamaLlms = llms("ollama", OsLlms);

View file

@ -1,6 +1,6 @@
import { LlmInfo } from "../types.js";
import { llms } from "../util.js";
export const OpenAiLlms: LlmInfo[] = [
export const OpenAiLlms = llms("openai", [
{
model: "gpt-3.5-turbo",
displayName: "GPT-3.5 Turbo",
@ -73,11 +73,13 @@ export const OpenAiLlms: LlmInfo[] = [
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
{
@ -85,11 +87,27 @@ export const OpenAiLlms: LlmInfo[] = [
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",
},
]);

View file

@ -0,0 +1,9 @@
import { LlmInfo } from "../types.js";
export const OsLlms: Omit<LlmInfo, "provider">[] = [
{
model: "starcoder2:3b",
displayName: "StarCoder 2 3B",
recommendedFor: ["autocomplete"],
},
];

View file

@ -0,0 +1,4 @@
import { llms } from "../util.js";
import { OsLlms } from "./os.js";
export const vllmLlms = llms("vllm", OsLlms);

View file

@ -0,0 +1,21 @@
import { llms } from "../util.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,
},
]);

View file

@ -1,5 +1,19 @@
export type UseCase = "chat" | "autocomplete" | "rerank" | "embed";
export type ParameterType = "string" | "number" | "boolean";
export interface Parameter {
key: string;
required: boolean;
valueType: ParameterType;
displayName?: string;
description?: string;
defaultValue?: any;
}
export interface LlmInfo {
model: string;
provider: string;
displayName?: string;
description?: string;
contextLength?: number;
@ -8,8 +22,16 @@ export interface LlmInfo {
/** If not set, assumes "text" only */
mediaTypes?: MediaType[];
recommendedFor?: UseCase[];
/** Any additional parameters required to configure the model */
extraParameters?: Parameter[];
}
export type LlmInfoWithProvider = LlmInfo & {
provider: string;
};
export enum MediaType {
Text = "text",
Image = "image",

View file

@ -0,0 +1,11 @@
import { LlmInfo } from "./types.js";
export function llms(
provider: string,
infos: Omit<LlmInfo, "provider">[],
): LlmInfo[] {
return infos.map((info) => ({
...info,
provider,
}));
}