🚧 updating model setup
This commit is contained in:
parent
90fab6317f
commit
e08c81b91b
14 changed files with 410 additions and 84 deletions
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
|
|
@ -51,6 +51,14 @@
|
|||
"module": "server.continuedev.models.reference.generate",
|
||||
"justMyCode": true
|
||||
},
|
||||
{
|
||||
"name": "Schema",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "continuedev.models.generate_json_schema",
|
||||
"justMyCode": true,
|
||||
"cwd": "${workspaceFolder}/server"
|
||||
},
|
||||
{
|
||||
"name": "Server",
|
||||
"type": "python",
|
||||
|
|
|
|||
|
|
@ -245,7 +245,8 @@
|
|||
"api_type": {
|
||||
"const": "azure"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["api_type"]
|
||||
},
|
||||
"then": {
|
||||
"required": ["engine", "api_version", "api_base"]
|
||||
|
|
|
|||
142
extensions/vscode/schema/ModelDescription.d.ts
vendored
Normal file
142
extensions/vscode/schema/ModelDescription.d.ts
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelDescription = ModelDescription1;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
*/
|
||||
export type Provider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
/**
|
||||
* The maximum context length of the LLM in tokens, as counted by count_tokens.
|
||||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* The chat template used to format messages. This is auto-detected for most models, but can be overridden here.
|
||||
*/
|
||||
export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
export type Temperature = number;
|
||||
/**
|
||||
* The top_p of the completion.
|
||||
*/
|
||||
export type TopP = number;
|
||||
/**
|
||||
* The top_k of the completion.
|
||||
*/
|
||||
export type TopK = number;
|
||||
/**
|
||||
* The presence penalty Aof the completion.
|
||||
*/
|
||||
export type PresencePenalty = number;
|
||||
/**
|
||||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
export type Timeout = number;
|
||||
/**
|
||||
* Whether to verify SSL certificates for requests.
|
||||
*/
|
||||
export type VerifySsl = boolean;
|
||||
/**
|
||||
* Path to a custom CA bundle to use when making the HTTP request
|
||||
*/
|
||||
export type CaBundlePath = string;
|
||||
/**
|
||||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
|
||||
export interface ModelDescription1 {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
model: Model;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Headers to use when making the HTTP request
|
||||
*/
|
||||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
20
extensions/vscode/schema/ModelProvider.d.ts
vendored
Normal file
20
extensions/vscode/schema/ModelProvider.d.ts
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelProvider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
|
|
@ -92,15 +92,15 @@ class ConfigPyCodeLensProvider implements vscode.CodeLensProvider {
|
|||
|
||||
if (
|
||||
!document.uri.fsPath.endsWith(".continue/config.py") &&
|
||||
!document.uri.fsPath.endsWith(".continue\\config.py")
|
||||
!document.uri.fsPath.endsWith(".continue\\config.py") &&
|
||||
!document.uri.fsPath.endsWith(".continue/config.json") &&
|
||||
!document.uri.fsPath.endsWith(".continue\\config.json")
|
||||
) {
|
||||
return codeLenses;
|
||||
}
|
||||
|
||||
const lines = document.getText().split(os.EOL);
|
||||
const lineOfModels = lines.findIndex((line) =>
|
||||
line.includes("models=Models(")
|
||||
);
|
||||
let lineOfModels = lines.findIndex((line) => line.includes('"models": ['));
|
||||
|
||||
if (lineOfModels >= 0) {
|
||||
const range = new vscode.Range(lineOfModels, 0, lineOfModels + 1, 0);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
MODEL_INFO,
|
||||
MODEL_PROVIDER_TAG_COLORS,
|
||||
ModelInfo,
|
||||
updatedObj,
|
||||
} from "../util/modelData";
|
||||
import { RootStore } from "../redux/store";
|
||||
import StyledMarkdownPreview from "../components/StyledMarkdownPreview";
|
||||
|
|
@ -215,12 +216,14 @@ function ModelConfig() {
|
|||
dimensions={pkg.dimensions}
|
||||
onClick={(e, dimensionChoices) => {
|
||||
if (disableModelCards()) return;
|
||||
const formParams: any = {};
|
||||
let formParams: any = {};
|
||||
for (const d of modelInfo.collectInputFor || []) {
|
||||
formParams[d.key] =
|
||||
d.inputType === "text"
|
||||
? formMethods.watch(d.key)
|
||||
: parseFloat(formMethods.watch(d.key));
|
||||
formParams = updatedObj(formParams, {
|
||||
[d.key]:
|
||||
d.inputType === "text"
|
||||
? formMethods.watch(d.key)
|
||||
: parseFloat(formMethods.watch(d.key)),
|
||||
});
|
||||
}
|
||||
|
||||
client?.addModelForRole("*", {
|
||||
|
|
@ -236,6 +239,7 @@ function ModelConfig() {
|
|||
}) || [])
|
||||
),
|
||||
...formParams,
|
||||
provider: modelInfo.provider,
|
||||
});
|
||||
navigate("/");
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ function Models() {
|
|||
description={modelInfo.description}
|
||||
tags={modelInfo.tags}
|
||||
icon={modelInfo.icon}
|
||||
refUrl={`https://continue.dev/docs/reference/Models/${modelInfo.class.toLowerCase()}`}
|
||||
refUrl={`https://continue.dev/docs/reference/Models/${modelInfo.provider.toLowerCase()}`}
|
||||
onClick={(e) => {
|
||||
navigate(`/modelconfig/${name}`);
|
||||
}}
|
||||
|
|
|
|||
142
gui/src/schema/ModelDescription.d.ts
vendored
Normal file
142
gui/src/schema/ModelDescription.d.ts
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelDescription = ModelDescription1;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
*/
|
||||
export type Provider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
/**
|
||||
* The maximum context length of the LLM in tokens, as counted by count_tokens.
|
||||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* The chat template used to format messages. This is auto-detected for most models, but can be overridden here.
|
||||
*/
|
||||
export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
export type Temperature = number;
|
||||
/**
|
||||
* The top_p of the completion.
|
||||
*/
|
||||
export type TopP = number;
|
||||
/**
|
||||
* The top_k of the completion.
|
||||
*/
|
||||
export type TopK = number;
|
||||
/**
|
||||
* The presence penalty Aof the completion.
|
||||
*/
|
||||
export type PresencePenalty = number;
|
||||
/**
|
||||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
export type Timeout = number;
|
||||
/**
|
||||
* Whether to verify SSL certificates for requests.
|
||||
*/
|
||||
export type VerifySsl = boolean;
|
||||
/**
|
||||
* Path to a custom CA bundle to use when making the HTTP request
|
||||
*/
|
||||
export type CaBundlePath = string;
|
||||
/**
|
||||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
|
||||
export interface ModelDescription1 {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
model: Model;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Headers to use when making the HTTP request
|
||||
*/
|
||||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
20
gui/src/schema/ModelProvider.d.ts
vendored
Normal file
20
gui/src/schema/ModelProvider.d.ts
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelProvider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import _ from "lodash";
|
||||
import { ModelProvider } from "../schema/ModelProvider";
|
||||
|
||||
function updatedObj(old: any, pathToValue: { [key: string]: any }) {
|
||||
export function updatedObj(old: any, pathToValue: { [key: string]: any }) {
|
||||
const newObject = _.cloneDeep(old);
|
||||
for (const key in pathToValue) {
|
||||
if (typeof pathToValue[key] === "function") {
|
||||
|
|
@ -55,7 +56,7 @@ const contextLengthInput: InputDescriptor = {
|
|||
};
|
||||
const temperatureInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "temperature",
|
||||
key: "completion_options.temperature",
|
||||
label: "Temperature",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -65,7 +66,7 @@ const temperatureInput: InputDescriptor = {
|
|||
};
|
||||
const topPInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "top_p",
|
||||
key: "completion_options.top_p",
|
||||
label: "Top-P",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -75,7 +76,7 @@ const topPInput: InputDescriptor = {
|
|||
};
|
||||
const topKInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "top_k",
|
||||
key: "completion_options.top_k",
|
||||
label: "Top-K",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -85,7 +86,7 @@ const topKInput: InputDescriptor = {
|
|||
};
|
||||
const presencePenaltyInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "presence_penalty",
|
||||
key: "completion_options.presence_penalty",
|
||||
label: "Presence Penalty",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -95,7 +96,7 @@ const presencePenaltyInput: InputDescriptor = {
|
|||
};
|
||||
const FrequencyPenaltyInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "frequency_penalty",
|
||||
key: "completion_options.frequency_penalty",
|
||||
label: "Frequency Penalty",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -112,17 +113,17 @@ const completionParamsInputs = [
|
|||
FrequencyPenaltyInput,
|
||||
];
|
||||
|
||||
const serverUrlInput: InputDescriptor = {
|
||||
const apiBaseInput: InputDescriptor = {
|
||||
inputType: CollectInputType.text,
|
||||
key: "server_url",
|
||||
label: "Server URL",
|
||||
key: "api_base",
|
||||
label: "API Base",
|
||||
placeholder: "e.g. http://localhost:8080",
|
||||
required: false,
|
||||
};
|
||||
|
||||
export interface ModelInfo {
|
||||
title: string;
|
||||
class: string;
|
||||
provider: ModelProvider;
|
||||
description: string;
|
||||
longDescription?: string;
|
||||
icon?: string;
|
||||
|
|
@ -159,19 +160,6 @@ export interface ModelPackage {
|
|||
dimensions?: PackageDimension[];
|
||||
}
|
||||
|
||||
enum EditPromptTemplates {
|
||||
"codellama" = "codellama_edit_prompt",
|
||||
"alpaca" = "alpaca_edit_prompt",
|
||||
}
|
||||
|
||||
enum ChatTemplates {
|
||||
"alpaca" = "template_alpaca_messages",
|
||||
"llama2" = "llama2_template_messages",
|
||||
"phind" = "phind_template_messages",
|
||||
"sqlcoder" = "sqlcoder_template_messages",
|
||||
"None" = "None",
|
||||
}
|
||||
|
||||
const codeLlamaInstruct: ModelPackage = {
|
||||
title: "CodeLlama Instruct",
|
||||
description:
|
||||
|
|
@ -181,7 +169,6 @@ const codeLlamaInstruct: ModelPackage = {
|
|||
title: "CodeLlama-7b-Instruct",
|
||||
model: "codellama:7b-instruct",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
},
|
||||
icon: "meta.png",
|
||||
dimensions: [
|
||||
|
|
@ -214,7 +201,6 @@ const llama2Chat: ModelPackage = {
|
|||
title: "Llama2-7b-Chat",
|
||||
model: "llama2:7b-chat",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
},
|
||||
icon: "meta.png",
|
||||
dimensions: [
|
||||
|
|
@ -248,10 +234,6 @@ const wizardCoder: ModelPackage = {
|
|||
title: "WizardCoder-7b-Python",
|
||||
model: "wizardcoder:7b-python",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.alpaca,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.alpaca,
|
||||
},
|
||||
},
|
||||
icon: "wizardlm.png",
|
||||
dimensions: [
|
||||
|
|
@ -283,10 +265,6 @@ const phindCodeLlama: ModelPackage = {
|
|||
title: "Phind CodeLlama",
|
||||
model: "phind-codellama",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.phind,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.codellama,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -298,10 +276,6 @@ const mistral: ModelPackage = {
|
|||
title: "Mistral",
|
||||
model: "mistral",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.codellama,
|
||||
},
|
||||
},
|
||||
icon: "mistral.png",
|
||||
};
|
||||
|
|
@ -314,10 +288,6 @@ const sqlCoder: ModelPackage = {
|
|||
title: "SQLCoder",
|
||||
model: "sqlcoder",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.sqlcoder,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.codellama,
|
||||
},
|
||||
},
|
||||
dimensions: [
|
||||
{
|
||||
|
|
@ -344,10 +314,6 @@ const codeup: ModelPackage = {
|
|||
title: "CodeUp",
|
||||
model: "codeup",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.alpaca,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -416,7 +382,7 @@ function replicateConvertModelName(model: string): string {
|
|||
export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
||||
openai: {
|
||||
title: "OpenAI",
|
||||
class: "OpenAI",
|
||||
provider: "openai",
|
||||
description: "Use gpt-4, gpt-3.5-turbo, or any other OpenAI model",
|
||||
longDescription:
|
||||
"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.",
|
||||
|
|
@ -436,7 +402,7 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
},
|
||||
anthropic: {
|
||||
title: "Anthropic",
|
||||
class: "AnthropicLLM",
|
||||
provider: "anthropic",
|
||||
description:
|
||||
"Claude-2 is a highly capable model with a 100k context length",
|
||||
icon: "anthropic.png",
|
||||
|
|
@ -452,6 +418,10 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
required: true,
|
||||
},
|
||||
...completionParamsInputs,
|
||||
{
|
||||
...contextLengthInput,
|
||||
defaultValue: 100_000,
|
||||
},
|
||||
],
|
||||
packages: [
|
||||
{
|
||||
|
|
@ -467,7 +437,7 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
},
|
||||
ollama: {
|
||||
title: "Ollama",
|
||||
class: "Ollama",
|
||||
provider: "ollama",
|
||||
description:
|
||||
"One of the fastest ways to get started with local models on Mac or Linux",
|
||||
longDescription:
|
||||
|
|
@ -477,12 +447,12 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
packages: osModels,
|
||||
collectInputFor: [
|
||||
...completionParamsInputs,
|
||||
{ ...serverUrlInput, defaultValue: "http://localhost:11434" },
|
||||
{ ...apiBaseInput, defaultValue: "http://localhost:11434" },
|
||||
],
|
||||
},
|
||||
together: {
|
||||
title: "TogetherAI",
|
||||
class: "TogetherLLM",
|
||||
provider: "together",
|
||||
description:
|
||||
"Use the TogetherAI API for extremely fast streaming of open-source models",
|
||||
icon: "together.png",
|
||||
|
|
@ -556,7 +526,7 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
},
|
||||
lmstudio: {
|
||||
title: "LM Studio",
|
||||
class: "GGML",
|
||||
provider: "openai-aiohttp",
|
||||
description:
|
||||
"One of the fastest ways to get started with local models on Mac or Windows",
|
||||
longDescription:
|
||||
|
|
@ -565,14 +535,13 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
tags: [ModelProviderTag["Local"], ModelProviderTag["Open-Source"]],
|
||||
params: {
|
||||
server_url: "http://localhost:1234",
|
||||
template_messages: ChatTemplates.None,
|
||||
},
|
||||
packages: osModels,
|
||||
collectInputFor: [...completionParamsInputs],
|
||||
},
|
||||
replicate: {
|
||||
title: "Replicate",
|
||||
class: "ReplicateLLM",
|
||||
provider: "replicate",
|
||||
description: "Use the Replicate API to run open-source models",
|
||||
longDescription: `Replicate is a hosted service that makes it easy to run ML models. To get started with Replicate:\n1. Obtain an API key from [here](https://replicate.com)\n2. Paste below\n3. Select a model preset`,
|
||||
params: {
|
||||
|
|
@ -645,7 +614,7 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
},
|
||||
llamacpp: {
|
||||
title: "llama.cpp",
|
||||
class: "LlamaCpp",
|
||||
provider: "llama.cpp",
|
||||
description: "If you are running the llama.cpp server from source",
|
||||
longDescription: `llama.cpp comes with a [built-in server](https://github.com/ggerganov/llama.cpp/tree/master/examples/server#llamacppexampleserver) that can be run from source. To do this:
|
||||
|
||||
|
|
@ -666,7 +635,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
textgenwebui: {
|
||||
title: "text-generation-webui",
|
||||
class: "TextGenWebUI",
|
||||
provider: "text-gen-webui",
|
||||
description: "A popular open-source front-end for serving LLMs locally",
|
||||
longDescription: `text-generation-webui is a comprehensive, open-source language model UI and local server. You can also set it up with an [OpenAI-compatible server extension](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#an-openedai-api-openai-like), but this model provider is made to interface with the built-in server, which has a different format. To setup the text-generation-webui server, take the following steps:
|
||||
|
||||
|
|
@ -687,7 +656,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
palm: {
|
||||
title: "Google PaLM API",
|
||||
class: "GooglePaLMAPI",
|
||||
provider: "google-palm",
|
||||
description:
|
||||
"Try out the Google PaLM API, which is currently in public preview, using an API key from Google Makersuite",
|
||||
longDescription: `To get started with Google Makersuite, obtain your API key from [here](https://developers.generativeai.google/products/makersuite) and paste it below.
|
||||
|
|
@ -717,7 +686,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
hftgi: {
|
||||
title: "HuggingFace TGI",
|
||||
class: "HuggingFaceTGI",
|
||||
provider: "huggingface-tgi",
|
||||
description:
|
||||
"HuggingFace Text Generation Inference is an advanced, highly-performant option for serving open-source models to multiple people",
|
||||
longDescription:
|
||||
|
|
@ -727,12 +696,12 @@ After it's up and running, you can start using Continue.`,
|
|||
packages: osModels,
|
||||
collectInputFor: [
|
||||
...completionParamsInputs,
|
||||
{ ...serverUrlInput, defaultValue: "http://localhost:8080" },
|
||||
{ ...apiBaseInput, defaultValue: "http://localhost:8080" },
|
||||
],
|
||||
},
|
||||
ggml: {
|
||||
title: "Other OpenAI-compatible API",
|
||||
class: "GGML",
|
||||
provider: "openai-aiohttp",
|
||||
description:
|
||||
"If you are using any other OpenAI-compatible API, for example text-gen-webui, FastChat, LocalAI, or llama-cpp-python, you can simply enter your server URL",
|
||||
longDescription: `If you are using any other OpenAI-compatible API, you can simply enter your server URL. If you still need to set up your model server, you can follow a guide below:
|
||||
|
|
@ -746,7 +715,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
...serverUrlInput,
|
||||
...apiBaseInput,
|
||||
defaultValue: "http://localhost:8000",
|
||||
},
|
||||
...completionParamsInputs,
|
||||
|
|
@ -756,8 +725,8 @@ After it's up and running, you can start using Continue.`,
|
|||
packages: osModels,
|
||||
},
|
||||
freetrial: {
|
||||
title: "GPT-4 limited free trial",
|
||||
class: "OpenAIFreeTrial",
|
||||
title: "OpenAI limited free trial",
|
||||
provider: "openai-free-trial",
|
||||
description:
|
||||
"New users can try out Continue for free using a proxy server that securely makes calls to OpenAI using our API key",
|
||||
longDescription:
|
||||
|
|
|
|||
18
schema/json/ModelProvider.json
Normal file
18
schema/json/ModelProvider.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"title": "ModelProvider",
|
||||
"enum": [
|
||||
"openai",
|
||||
"openai-free-trial",
|
||||
"openai-aiohttp",
|
||||
"anthropic",
|
||||
"together",
|
||||
"ollama",
|
||||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
|
|
@ -240,15 +240,9 @@ class SerializedContinueConfig(BaseModel):
|
|||
with SerializedContinueConfig.edit_config() as config:
|
||||
if role == "*":
|
||||
config.model_roles.default = title
|
||||
|
||||
if config.model_roles.chat is None:
|
||||
config.model_roles.chat = title
|
||||
|
||||
if config.model_roles.edit is None:
|
||||
config.model_roles.edit = title
|
||||
|
||||
if config.model_roles.summarize is None:
|
||||
config.model_roles.summarize = title
|
||||
config.model_roles.chat = title
|
||||
config.model_roles.edit = title
|
||||
config.model_roles.summarize = title
|
||||
else:
|
||||
config.model_roles.__setattr__(role, title)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ import os
|
|||
from pydantic import schema_json_of
|
||||
|
||||
from ..core.config.config import ContinueConfig
|
||||
from ..core.config.serialized_config import ModelDescription, SerializedContinueConfig
|
||||
from ..core.config.serialized_config import (
|
||||
ModelDescription,
|
||||
ModelProvider,
|
||||
SerializedContinueConfig,
|
||||
)
|
||||
from ..core.context import ContextItem, ContextItemId
|
||||
from ..core.main import (
|
||||
ContextProviderDescription,
|
||||
|
|
@ -32,7 +36,7 @@ MODELS_TO_GENERATE = (
|
|||
SlashCommandDescription,
|
||||
ContextProviderDescription,
|
||||
]
|
||||
+ [SerializedContinueConfig, ModelDescription]
|
||||
+ [SerializedContinueConfig, ModelDescription, ModelProvider]
|
||||
+ [ContinueConfig]
|
||||
+ [ContextItem, ContextItemId]
|
||||
+ [Models]
|
||||
|
|
@ -55,6 +59,8 @@ def main():
|
|||
clear_schemas()
|
||||
for model in MODELS_TO_GENERATE:
|
||||
title = RENAMES.get(model.__name__, model.__name__)
|
||||
if model == ModelProvider:
|
||||
title = "ModelProvider"
|
||||
try:
|
||||
json = schema_json_of(model, indent=2, title=title)
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ class GUIProtocolServer:
|
|||
async def add_model_for_role(self, role: str, model: ModelDescription):
|
||||
SerializedContinueConfig.add_model(model)
|
||||
SerializedContinueConfig.set_model_for_role(model.title, role)
|
||||
await self.reload_config()
|
||||
await self.send_config_update()
|
||||
|
||||
_running_autopilots: Dict[str, Autopilot] = {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue