feat: Update devchat-api with latest LLMs

- Remove deprecated 1106 and 16k GPT-3.5 model configs
- Update GPT-3.5 config to latest stable version
- Update Claude, Xinghuo, GLM, ERNIEbot to latest versions
- Adjust default model to Claude 2.1
- Validate and test latest model integrations
This commit is contained in:
bobo.yang 2024-02-01 22:39:56 +08:00
parent f36d14af8a
commit 59ad9088cd
4 changed files with 32 additions and 121 deletions

View File

@ -154,88 +154,6 @@
"order": 2,
"markdownDescription": "Specify the properties for gpt-3.5-turbo model. Leave it blank if you won't use this llm model. [how to set?](https://platform.openai.com/docs/api-reference/chat/create#temperature)"
},
"devchat.Model.gpt-3-5-1106": {
"type": "object",
"properties": {
"provider": {
"type": "string",
"default": "devchat",
"enum": [
"devchat",
"openai"
],
"description": "[required*] Specify which provider host this llm model"
},
"temperature": {
"type": "number",
"default": 0.3,
"description": "[optional*] What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."
},
"max_tokens": {
"type": "number",
"default": 1000,
"description": "[optional*] The maximum number of tokens to generate in the chat completion.\nThe total length of input tokens and generated tokens is limited by the model's context length. Example Python code for counting tokens."
},
"presence_penalty": {
"type": "number",
"default": 0,
"description": "[optional*] Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."
},
"frequency_penalty": {
"type": "number",
"default": 0,
"description": "[optional*] Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."
}
},
"required": [
"provider",
"key"
],
"additionalProperties": false,
"order": 3,
"markdownDescription": "Specify the properties for gpt-3.5-turbo-1106 model. Leave it blank if you won't use this llm model. [how to set?](https://platform.openai.com/docs/api-reference/chat/create#temperature)"
},
"devchat.Model.gpt-3-5-16k": {
"type": "object",
"properties": {
"provider": {
"type": "string",
"default": "devchat",
"enum": [
"devchat",
"openai"
],
"description": "[required*] Specify which provider host this llm model"
},
"temperature": {
"type": "number",
"default": 0.3,
"description": "[optional*] What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."
},
"max_tokens": {
"type": "number",
"default": 1000,
"description": "[optional*] The maximum number of tokens to generate in the chat completion.\nThe total length of input tokens and generated tokens is limited by the model's context length. Example Python code for counting tokens."
},
"presence_penalty": {
"type": "number",
"default": 0,
"description": "[optional*] Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."
},
"frequency_penalty": {
"type": "number",
"default": 0,
"description": "[optional*] Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."
}
},
"required": [
"provider",
"key"
],
"additionalProperties": false,
"order": 4,
"markdownDescription": "Specify properties for gpt-3.5-turbo-16k model. Leave it blank if you won't use this llm model. [how to set?](https://platform.openai.com/docs/api-reference/chat/create#temperature) "
},
"devchat.Model.gpt-4": {
"type": "object",
"properties": {
@ -473,14 +391,12 @@
"default": "gpt-3.5-turbo",
"enum": [
"gpt-3.5-turbo",
"gpt-3.5-turbo-1106",
"gpt-3.5-turbo-16k",
"gpt-4",
"gpt-4-1106-preview",
"claude-2",
"xinghuo-2",
"chatglm_pro",
"ERNIE-Bot",
"claude-2.1",
"xinghuo-3.5",
"GLM-4",
"ERNIE-Bot-4.0",
"CodeLlama-34b-Instruct",
"llama-2-70b-chat"
]

View File

@ -152,7 +152,7 @@ async function configUpdateTo0924() {
}
if (!defaultModel) {
await vscode.workspace.getConfiguration("devchat").update("defaultModel", "claude-2", vscode.ConfigurationTarget.Global);
await vscode.workspace.getConfiguration("devchat").update("defaultModel", "claude-2.1", vscode.ConfigurationTarget.Global);
}
}
@ -245,6 +245,16 @@ async function updateInvalidSettings() {
}
}
async function updateInvalidDefaultModel() {
const defaultModel: any = UiUtilWrapper.getConfiguration("devchat", "defaultModel");
if (defaultModel === "gpt-3.5-turbo-1106" || defaultModel === "gpt-3.5-turbo-16k") {
await vscode.workspace.getConfiguration("devchat").update("defaultModel", "gpt-3.5-turbo", vscode.ConfigurationTarget.Global);
}
}
// "gpt-3.5-turbo-1106",
// "gpt-3.5-turbo-16k",
async function activate(context: vscode.ExtensionContext) {
ExtensionContextHolder.context = context;
@ -256,6 +266,7 @@ async function activate(context: vscode.ExtensionContext) {
await configUpdateTo1115();
await setLangDefaultValue();
await updateInvalidSettings();
await updateInvalidDefaultModel();
regLanguageContext();

View File

@ -56,14 +56,6 @@ export class ApiKeyManager {
if (openaiModel) {
modelList.push(openaiModel.model);
}
const openaiModel1 = await modelProperties('Model.gpt-3-5-1106', "gpt-3.5-turbo-1106");
if (openaiModel1) {
modelList.push(openaiModel1.model);
}
const openaiModel2 = await modelProperties('Model.gpt-3-5-16k', "gpt-3.5-turbo-16k");
if (openaiModel2) {
modelList.push(openaiModel2.model);
}
const openaiModel3 = await modelProperties('Model.gpt-4', "gpt-4");
if (openaiModel3) {
modelList.push(openaiModel3.model);
@ -72,19 +64,19 @@ export class ApiKeyManager {
if (openaiModel4) {
modelList.push(openaiModel4.model);
}
const claudeModel = await modelProperties('Model.claude-2', "claude-2");
const claudeModel = await modelProperties('Model.claude-2', "claude-2.1");
if (claudeModel) {
modelList.push(claudeModel.model);
}
const xinghuoModel = await modelProperties('Model.xinghuo-2', "xinghuo-2");
const xinghuoModel = await modelProperties('Model.xinghuo-2', "xinghuo-3.5");
if (xinghuoModel) {
modelList.push(xinghuoModel.model);
}
const glmModel = await modelProperties('Model.chatglm_pro', "chatglm_pro");
const glmModel = await modelProperties('Model.chatglm_pro', "GLM-4");
if (glmModel) {
modelList.push(glmModel.model);
}
const erniebotModel = await modelProperties('Model.ERNIE-Bot', "ERNIE-Bot");
const erniebotModel = await modelProperties('Model.ERNIE-Bot', "ERNIE-Bot-4.0");
if (erniebotModel) {
modelList.push(erniebotModel.model);
}
@ -161,29 +153,23 @@ export class ApiKeyManager {
if (llmModelT === "gpt-3.5-turbo") {
return await modelProperties('Model.gpt-3-5', "gpt-3.5-turbo");
}
if (llmModelT === "gpt-3.5-turbo-1106") {
return await modelProperties('Model.gpt-3-5-1106', "gpt-3.5-turbo-1106");
}
if (llmModelT === "gpt-3.5-turbo-16k") {
return await modelProperties('Model.gpt-3-5-16k', "gpt-3.5-turbo-16k");
}
if (llmModelT === "gpt-4") {
return await modelProperties('Model.gpt-4', "gpt-4");
}
if (llmModelT === "gpt-4-1106-preview") {
return await modelProperties('Model.gpt-4-turbo', "gpt-4-1106-preview");
}
if (llmModelT === "claude-2") {
return await modelProperties('Model.claude-2', "claude-2");
if (llmModelT === "claude-2.1") {
return await modelProperties('Model.claude-2', "claude-2.1");
}
if (llmModelT === "xinghuo-2") {
return await modelProperties('Model.xinghuo-2', "xinghuo-2");
if (llmModelT === "xinghuo-3.5") {
return await modelProperties('Model.xinghuo-2', "xinghuo-3.5");
}
if (llmModelT === "chatglm_pro") {
return await modelProperties('Model.chatglm_pro', "chatglm_pro");
if (llmModelT === "GLM-4") {
return await modelProperties('Model.chatglm_pro', "GLM-4");
}
if (llmModelT === "ERNIE-Bot") {
return await modelProperties('Model.ERNIE-Bot', "ERNIE-Bot");
if (llmModelT === "ERNIE-Bot-4.0") {
return await modelProperties('Model.ERNIE-Bot', "ERNIE-Bot-4.0");
}
if (llmModelT === "CodeLlama-34b-Instruct") {
return await modelProperties('Model.CodeLlama-34b-Instruct', "CodeLlama-34b-Instruct");

View File

@ -18,14 +18,12 @@ export async function saveModelSettings(): Promise<void> {
// support models
const supportModels = {
"Model.gpt-3-5": "gpt-3.5-turbo",
"Model.gpt-3-5-1106": "gpt-3.5-turbo-1106",
"Model.gpt-3-5-16k": "gpt-3.5-turbo-16k",
"Model.gpt-4": "gpt-4",
"Model.gpt-4-turbo": "gpt-4-1106-preview",
"Model.claude-2": "claude-2",
"Model.xinghuo-2": "xinghuo-2",
"Model.chatglm_pro": "chatglm_pro",
"Model.ERNIE-Bot": "ERNIE-Bot",
"Model.claude-2": "claude-2.1",
"Model.xinghuo-2": "xinghuo-3.5",
"Model.chatglm_pro": "GLM-4",
"Model.ERNIE-Bot": "ERNIE-Bot-4.0",
"Model.CodeLlama-34b-Instruct": "CodeLlama-34b-Instruct",
"Model.llama-2-70b-chat": "llama-2-70b-chat"
};