✨ Mistral LLM Provider
This commit is contained in:
parent
ab3a8fd662
commit
3c7821630a
4 changed files with 142 additions and 11 deletions
|
|
@ -24,6 +24,8 @@ declare global {
|
|||
region?: string;
|
||||
projectId?: string;
|
||||
|
||||
_fetch?: (input: any, init?: RequestInit) => Promise<any>;
|
||||
|
||||
complete(prompt: string, options?: LLMFullCompletionOptions): Promise<string>;
|
||||
|
||||
streamComplete(
|
||||
|
|
@ -36,6 +38,11 @@ declare global {
|
|||
options?: LLMFullCompletionOptions
|
||||
): AsyncGenerator<ChatMessage>;
|
||||
|
||||
chat(
|
||||
messages: ChatMessage[],
|
||||
options?: LLMFullCompletionOptions
|
||||
): Promise<ChatMessage>;
|
||||
|
||||
countTokens(text: string): number;
|
||||
}
|
||||
|
||||
|
|
@ -123,6 +130,14 @@ declare global {
|
|||
}
|
||||
|
||||
export interface ContextItem {
|
||||
content: string;
|
||||
name: string;
|
||||
description: string;
|
||||
editing?: boolean;
|
||||
editable?: boolean;
|
||||
}
|
||||
|
||||
export interface ContextItemWithId {
|
||||
content: string;
|
||||
name: string;
|
||||
description: string;
|
||||
|
|
@ -133,7 +148,7 @@ declare global {
|
|||
|
||||
export interface ChatHistoryItem {
|
||||
message: ChatMessage;
|
||||
contextItems: ContextItem[];
|
||||
contextItems: ContextItemWithId[];
|
||||
promptLogs?: [string, string][]; // [prompt, completion]
|
||||
}
|
||||
|
||||
|
|
@ -193,11 +208,13 @@ declare global {
|
|||
options?: LLMOptions;
|
||||
streamCompletion?: (
|
||||
prompt: string,
|
||||
options: CompletionOptions
|
||||
options: CompletionOptions,
|
||||
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>
|
||||
) => AsyncGenerator<string>;
|
||||
streamChat?: (
|
||||
messages: ChatMessage[],
|
||||
options: CompletionOptions
|
||||
options: CompletionOptions,
|
||||
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>
|
||||
) => AsyncGenerator<string>;
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +233,7 @@ declare global {
|
|||
getConfigJsUrl(): Promise<string | undefined>;
|
||||
getDiff(): Promise<string>;
|
||||
getTerminalContents(): Promise<string>;
|
||||
listWorkspaceContents(): Promise<string[]>;
|
||||
listWorkspaceContents(directory?: string): Promise<string[]>;
|
||||
getWorkspaceDirs(): Promise<string[]>;
|
||||
writeFile(path: string, contents: string): Promise<void>;
|
||||
showVirtualFile(title: string, contents: string): Promise<void>;
|
||||
|
|
@ -230,6 +247,7 @@ declare global {
|
|||
newContents: string,
|
||||
stepIndex: number
|
||||
): Promise<void>;
|
||||
getOpenFiles(): Promise<string[]>;
|
||||
}
|
||||
|
||||
// Slash Commands
|
||||
|
|
@ -237,11 +255,11 @@ declare global {
|
|||
export interface ContinueSDK {
|
||||
ide: IDE;
|
||||
llm: ILLM;
|
||||
addContextItem: (item: ContextItem) => void;
|
||||
addContextItem: (item: ContextItemWithId) => void;
|
||||
history: ChatMessage[];
|
||||
input: string;
|
||||
params?: any;
|
||||
contextItems: ContextItem[];
|
||||
contextItems: ContextItemWithId[];
|
||||
}
|
||||
|
||||
export interface SlashCommand {
|
||||
|
|
@ -273,7 +291,8 @@ declare global {
|
|||
| "google"
|
||||
| "search"
|
||||
| "url"
|
||||
| "tree";
|
||||
| "tree"
|
||||
| "http";
|
||||
|
||||
type TemplateType =
|
||||
| "llama2"
|
||||
|
|
@ -331,7 +350,11 @@ declare global {
|
|||
// Google PaLM
|
||||
| "chat-bison-001"
|
||||
// Gemini
|
||||
| "gemini-pro";
|
||||
| "gemini-pro"
|
||||
// Mistral
|
||||
| "mistral-tiny"
|
||||
| "mistral-small"
|
||||
| "mistral-medium";
|
||||
|
||||
export interface RequestOptions {
|
||||
timeout?: number;
|
||||
|
|
@ -458,6 +481,7 @@ declare global {
|
|||
disableIndexing?: boolean;
|
||||
userToken?: string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export {};
|
||||
|
|
|
|||
6
core/index.d.ts
vendored
6
core/index.d.ts
vendored
|
|
@ -348,7 +348,11 @@ export type ModelName =
|
|||
// Google PaLM
|
||||
| "chat-bison-001"
|
||||
// Gemini
|
||||
| "gemini-pro";
|
||||
| "gemini-pro"
|
||||
// Mistral
|
||||
| "mistral-tiny"
|
||||
| "mistral-small"
|
||||
| "mistral-medium";
|
||||
|
||||
export interface RequestOptions {
|
||||
timeout?: number;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@
|
|||
"text-gen-webui",
|
||||
"google-palm",
|
||||
"lmstudio",
|
||||
"llamafile"
|
||||
"llamafile",
|
||||
"mistral"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -544,6 +545,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["mistral"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": ["mistral-tiny", "mistral-small", "mistral-medium"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ const mistral: ModelPackage = {
|
|||
params: {
|
||||
title: "Mistral",
|
||||
model: "mistral-7b",
|
||||
contextLength: 2048,
|
||||
contextLength: 4096,
|
||||
},
|
||||
dimensions: [
|
||||
{
|
||||
|
|
@ -305,6 +305,62 @@ const mistral: ModelPackage = {
|
|||
providerOptions: ["ollama", "lmstudio", "together", "llamacpp", "replicate"],
|
||||
};
|
||||
|
||||
const mistralTiny: ModelPackage = {
|
||||
title: "Mistral Tiny (7b)",
|
||||
description: "An 7b parameter model created by Mistral AI",
|
||||
params: {
|
||||
title: "Mistral",
|
||||
model: "mistral-tiny",
|
||||
contextLength: 4096,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: [
|
||||
"ollama",
|
||||
"lmstudio",
|
||||
"together",
|
||||
"llamacpp",
|
||||
"replicate",
|
||||
"mistral",
|
||||
],
|
||||
};
|
||||
const mistralSmall: ModelPackage = {
|
||||
title: "Mixtral (8x7b)",
|
||||
description:
|
||||
"An 8x7b parameter Mixture of Experts model created by Mistral AI (a.k.a Mistral Small)",
|
||||
params: {
|
||||
title: "Mixtral",
|
||||
model: "mistral-small",
|
||||
contextLength: 4096,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: [
|
||||
"ollama",
|
||||
"lmstudio",
|
||||
"together",
|
||||
"llamacpp",
|
||||
"replicate",
|
||||
"mistral",
|
||||
],
|
||||
};
|
||||
const mistralMedium: ModelPackage = {
|
||||
title: "Mistral Medium",
|
||||
description: "A highly capable model created by Mistral AI",
|
||||
params: {
|
||||
title: "Mistral Medium",
|
||||
model: "mistral-medium",
|
||||
contextLength: 4096,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: [
|
||||
"ollama",
|
||||
"lmstudio",
|
||||
"together",
|
||||
"llamacpp",
|
||||
"replicate",
|
||||
"mistral",
|
||||
],
|
||||
};
|
||||
|
||||
const gemini: ModelPackage = {
|
||||
title: "Gemini Pro",
|
||||
description: "A highly capable model created by Google DeepMind",
|
||||
|
|
@ -520,6 +576,35 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
|
|||
{ ...apiBaseInput, defaultValue: "http://localhost:11434" },
|
||||
],
|
||||
},
|
||||
mistral: {
|
||||
title: "Mistral API",
|
||||
provider: "mistral",
|
||||
description:
|
||||
"The Mistral API provides hosted access to their models, including Mistral-7b, Mixtral, and the very capable mistral-medium",
|
||||
icon: "mistral.png",
|
||||
longDescription: `To get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)`,
|
||||
tags: [
|
||||
ModelProviderTag["Requires API Key"],
|
||||
ModelProviderTag["Open-Source"],
|
||||
],
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: CollectInputType.text,
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Mistral API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputs,
|
||||
],
|
||||
packages: [mistralTiny, mistralSmall, mistralMedium].map((p) => {
|
||||
p.params.contextLength = 4096;
|
||||
return p;
|
||||
}),
|
||||
},
|
||||
llamafile: {
|
||||
title: "llamafile",
|
||||
provider: "llamafile",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue