From ef54191d96b89ee5f47588f559aeeeecd5e0cb51 Mon Sep 17 00:00:00 2001 From: Rubu Jam Date: Mon, 22 Jul 2024 14:18:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(model):=20clear?= =?UTF-8?q?=20and=20add=20models=20(#3208)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +-- src/config/modelProviders/deepseek.ts | 1 + src/config/modelProviders/google.ts | 24 ++++----------- src/config/modelProviders/groq.ts | 16 ++++++---- src/config/modelProviders/ollama.ts | 29 +++++++++++++++++-- src/config/modelProviders/openai.ts | 21 ++++++++------ src/config/modelProviders/perplexity.ts | 6 ++-- src/config/modelProviders/togetherai.ts | 4 +-- src/config/modelProviders/zeroone.ts | 10 ++----- src/config/modelProviders/zhipu.ts | 12 +++++--- .../openai/__snapshots__/index.test.ts.snap | 4 +-- .../__snapshots__/index.test.ts.snap | 2 +- .../__snapshots__/index.test.ts.snap | 6 ++-- .../config/__snapshots__/index.test.ts.snap | 2 +- 14 files changed, 81 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index acb5e26cda97..9e885455be1d 100644 --- a/package.json +++ b/package.json @@ -113,9 +113,9 @@ "@khmyznikov/pwa-install": "^0.3.9", "@lobehub/chat-plugin-sdk": "^1.32.4", "@lobehub/chat-plugins-gateway": "^1.9.0", - "@lobehub/icons": "^1.26.0", + "@lobehub/icons": "^1.27.0", "@lobehub/tts": "^1.24.3", - "@lobehub/ui": "^1.146.6", + "@lobehub/ui": "^1.146.9", "@microsoft/fetch-event-source": "^2.0.1", "@neondatabase/serverless": "^0.9.4", "@next/third-parties": "^14.2.4", diff --git a/src/config/modelProviders/deepseek.ts b/src/config/modelProviders/deepseek.ts index 759d2486d1fe..1578401258af 100644 --- a/src/config/modelProviders/deepseek.ts +++ b/src/config/modelProviders/deepseek.ts @@ -1,5 +1,6 @@ import { ModelProviderCard } from '@/types/llm'; +// ref https://platform.deepseek.com/api-docs/pricing const DeepSeek: ModelProviderCard = { chatModels: [ { diff --git a/src/config/modelProviders/google.ts b/src/config/modelProviders/google.ts index 02239c9cd4b6..740af3127020 100644 --- a/src/config/modelProviders/google.ts +++ b/src/config/modelProviders/google.ts @@ -43,14 +43,16 @@ const Google: ModelProviderCard = { vision: true, }, { - description: 'The best model for scaling across a wide range of tasks. This is the latest model.', + description: + 'The best model for scaling across a wide range of tasks. This is the latest model.', displayName: 'Gemini 1.0 Pro', id: 'gemini-1.0-pro-latest', maxOutput: 2048, tokens: 30_720 + 2048, }, { - description: 'The best model for scaling across a wide range of tasks. This is a stable model that supports tuning.', + description: + 'The best model for scaling across a wide range of tasks. This is a stable model that supports tuning.', displayName: 'Gemini 1.0 Pro 001 (Tuning)', functionCall: true, id: 'gemini-1.0-pro-001', @@ -58,27 +60,13 @@ const Google: ModelProviderCard = { tokens: 30_720 + 2048, }, { - description: 'The best model for scaling across a wide range of tasks. Released April 9, 2024.', + description: + 'The best model for scaling across a wide range of tasks. Released April 9, 2024.', displayName: 'Gemini 1.0 Pro 002 (Tuning)', id: 'gemini-1.0-pro-002', maxOutput: 2048, tokens: 30_720 + 2048, }, - { - description: 'The most capable model for highly complex tasks', - displayName: 'Gemini 1.0 Ultra', - id: 'gemini-ultra', - maxOutput: 2048, - tokens: 32_768, - }, - { - description: 'A legacy text-only model optimized for chat conversations', - displayName: 'PaLM 2 Chat (Legacy)', - id: 'chat-bison-001', - legacy: true, - maxOutput: 1024, - // tokens: 4096 + 1024, // none tokens test - } ], checkModel: 'gemini-1.5-flash', id: 'google', diff --git a/src/config/modelProviders/groq.ts b/src/config/modelProviders/groq.ts index fec5b1e96007..321ef8b5dbcb 100644 --- a/src/config/modelProviders/groq.ts +++ b/src/config/modelProviders/groq.ts @@ -4,7 +4,7 @@ import { ModelProviderCard } from '@/types/llm'; const Groq: ModelProviderCard = { chatModels: [ { - displayName: 'LLaMA3-3-70B', + displayName: 'LLaMA3 70B', enabled: true, functionCall: true, id: 'llama3-70b-8192', @@ -18,14 +18,20 @@ const Groq: ModelProviderCard = { tokens: 32_768, }, { - displayName: 'Gemma-7b-it', - enabled: true, + displayName: 'Gemma 7B', functionCall: true, id: 'gemma-7b-it', tokens: 8192, }, { - displayName: 'LLaMA3-3-8B', + displayName: 'Gemma2 9B', + enabled: true, + functionCall: true, + id: 'gemma2-9b-it', + tokens: 8192, + }, + { + displayName: 'LLaMA3 8B', enabled: true, functionCall: true, id: 'llama3-8b-8192', @@ -37,7 +43,7 @@ const Groq: ModelProviderCard = { tokens: 4096, }, ], - checkModel: 'gemma-7b-it', + checkModel: 'gemma2-9b-it', id: 'groq', name: 'Groq', proxyUrl: { diff --git a/src/config/modelProviders/ollama.ts b/src/config/modelProviders/ollama.ts index d56389fba3b8..c19d23f4919b 100644 --- a/src/config/modelProviders/ollama.ts +++ b/src/config/modelProviders/ollama.ts @@ -1,5 +1,6 @@ import { ModelProviderCard } from '@/types/llm'; +// ref https://ollama.com/library const Ollama: ModelProviderCard = { chatModels: [ { @@ -78,6 +79,28 @@ const Ollama: ModelProviderCard = { id: 'gemma:2b', tokens: 8192, }, + { + displayName: 'Deepseek V2 16B', + enabled: true, + id: 'deepseek-v2', + tokens: 32_000, + }, + { + displayName: 'Deepseek V2 236B', + id: 'deepseek-v2:236b', + tokens: 128_000, + }, + { + displayName: 'Deepseek Coder V2 16B', // https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct + enabled: true, + id: 'deepseek-coder-v2', + tokens: 128_000, + }, + { + displayName: 'Deepseek Coder V2 236B', // https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct + id: 'deepseek-coder-v2:236b', + tokens: 128_000, + }, { displayName: 'Llama2 Chat 13B', id: 'llama2:13b', @@ -135,10 +158,10 @@ const Ollama: ModelProviderCard = { tokens: 16_384, }, { - displayName: 'Mistral', + displayName: 'MathΣtral', enabled: true, - id: 'mistral', - tokens: 32_768, // https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/blob/main/config.json + id: 'mathstral', + tokens: 32_000, // https://huggingface.co/mistralai/mathstral-7B-v0.1 }, { displayName: 'Mixtral 8x7B', diff --git a/src/config/modelProviders/openai.ts b/src/config/modelProviders/openai.ts index 7d4483bc7739..c8f919b4c21e 100644 --- a/src/config/modelProviders/openai.ts +++ b/src/config/modelProviders/openai.ts @@ -1,6 +1,8 @@ import { ModelProviderCard } from '@/types/llm'; -// ref https://platform.openai.com/docs/models +// ref: +// https://platform.openai.com/docs/models +// https://platform.openai.com/docs/deprecations const OpenAI: ModelProviderCard = { chatModels: [ { @@ -53,14 +55,14 @@ const OpenAI: ModelProviderCard = { tokens: 128_000, }, { - description: 'Currently points to gpt-4-1106-vision-preview', + description: 'Currently points to gpt-4-1106-vision-preview', // Will be discontinued on December 6, 2024 displayName: 'GPT-4 Turbo Vision Preview', id: 'gpt-4-vision-preview', tokens: 128_000, vision: true, }, { - displayName: 'GPT-4 Turbo Vision Preview (1106)', + displayName: 'GPT-4 Turbo Vision Preview (1106)', // Will be discontinued on December 6, 2024 id: 'gpt-4-1106-vision-preview', tokens: 128_000, vision: true, @@ -85,20 +87,21 @@ const OpenAI: ModelProviderCard = { tokens: 8192, }, { - description: 'Currently points to gpt-4-32k-0613', + description: 'Currently points to gpt-4-32k-0613', // Will be discontinued on June 6, 2025 displayName: 'GPT-4 32K', functionCall: true, id: 'gpt-4-32k', tokens: 32_768, }, { - displayName: 'GPT-4 32K (0613)', + displayName: 'GPT-4 32K (0613)', // Will be discontinued on June 6, 2025 functionCall: true, id: 'gpt-4-32k-0613', tokens: 32_768, }, { - description: 'GPT 3.5 Turbo,适用于各种文本生成和理解任务', + description: + 'GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125', displayName: 'GPT-3.5 Turbo', functionCall: true, id: 'gpt-3.5-turbo', @@ -122,20 +125,20 @@ const OpenAI: ModelProviderCard = { tokens: 4096, }, { - description: 'Currently points to gpt-3.5-turbo-16k-0613', + description: 'Currently points to gpt-3.5-turbo-16k-0613', // Will be discontinued on September 13, 2024 displayName: 'GPT-3.5 Turbo 16K', id: 'gpt-3.5-turbo-16k', legacy: true, tokens: 16_385, }, { - displayName: 'GPT-3.5 Turbo (0613)', + displayName: 'GPT-3.5 Turbo (0613)', // Will be discontinued on September 13, 2024 id: 'gpt-3.5-turbo-0613', legacy: true, tokens: 4096, }, { - displayName: 'GPT-3.5 Turbo 16K (0613)', + description: 'Currently points to gpt-3.5-turbo-16k-0613', // Will be discontinued on September 13, 2024 id: 'gpt-3.5-turbo-16k-0613', legacy: true, tokens: 16_385, diff --git a/src/config/modelProviders/perplexity.ts b/src/config/modelProviders/perplexity.ts index 8aac0991037b..d4403f407f89 100644 --- a/src/config/modelProviders/perplexity.ts +++ b/src/config/modelProviders/perplexity.ts @@ -4,7 +4,7 @@ import { ModelProviderCard } from '@/types/llm'; const Perplexity: ModelProviderCard = { chatModels: [ { - displayName: 'Perplexity 7B Chat', + displayName: 'Perplexity 8B Chat', id: 'llama-3-sonar-small-32k-chat', tokens: 32_768, }, @@ -15,7 +15,7 @@ const Perplexity: ModelProviderCard = { tokens: 32_768, }, { - displayName: 'Perplexity 7B Online', + displayName: 'Perplexity 8B Online', id: 'llama-3-sonar-small-32k-online', tokens: 28_000, }, @@ -41,7 +41,7 @@ const Perplexity: ModelProviderCard = { tokens: 16_384, }, ], - checkModel: 'pplx-7b-chat', + checkModel: 'llama-3-8b-instruct', id: 'perplexity', name: 'Perplexity', proxyUrl: { diff --git a/src/config/modelProviders/togetherai.ts b/src/config/modelProviders/togetherai.ts index 7f296b190663..c5ec6d47d728 100644 --- a/src/config/modelProviders/togetherai.ts +++ b/src/config/modelProviders/togetherai.ts @@ -58,9 +58,9 @@ const TogetherAI: ModelProviderCard = { tokens: 32_768, }, { - displayName: 'Qwen 1.5 Chat (14B)', + displayName: 'Qwen 1.5 Chat (32B)', enabled: true, - id: 'Qwen/Qwen1.5-14B-Chat', + id: 'Qwen/Qwen1.5-32B-Chat', tokens: 32_768, }, { diff --git a/src/config/modelProviders/zeroone.ts b/src/config/modelProviders/zeroone.ts index 5882249e815b..4f8d14cf5985 100644 --- a/src/config/modelProviders/zeroone.ts +++ b/src/config/modelProviders/zeroone.ts @@ -11,7 +11,8 @@ const ZeroOne: ModelProviderCard = { tokens: 32_768, }, { - description: '在 yi-large 模型的基础上支持并强化了工具调用的能力,适用于各种需要搭建 agent 或 workflow 的业务场景。', + description: + '在 yi-large 模型的基础上支持并强化了工具调用的能力,适用于各种需要搭建 agent 或 workflow 的业务场景。', displayName: 'Yi Large FC', enabled: true, functionCall: true, @@ -67,14 +68,9 @@ const ZeroOne: ModelProviderCard = { id: 'yi-large-preview', tokens: 16_384, }, - { - description: '「兼容版本模型」实时信息获取,以及文本推理能力增强。', - displayName: 'Yi Large RAG Preview', - id: 'yi-large-rag-preview', - tokens: 16_384, - }, ], checkModel: 'yi-large', + disableBrowserRequest: true, id: 'zeroone', name: '01.AI', }; diff --git a/src/config/modelProviders/zhipu.ts b/src/config/modelProviders/zhipu.ts index ba2d0504d469..d7611b17e247 100644 --- a/src/config/modelProviders/zhipu.ts +++ b/src/config/modelProviders/zhipu.ts @@ -6,7 +6,8 @@ import { ModelProviderCard } from '@/types/llm'; const ZhiPu: ModelProviderCard = { chatModels: [ { - description: 'GLM-4-AllTools 是专门为支持智能体和相关任务而进一步优化的模型版本。它能够自主理解用户的意图,规划复杂的指令,并能够调用一个或多个工具(例如网络浏览器、代码解释器和文本生图像)以完成复杂的任务。', + description: + 'GLM-4-AllTools 是专门为支持智能体和相关任务而进一步优化的模型版本。它能够自主理解用户的意图,规划复杂的指令,并能够调用一个或多个工具(例如网络浏览器、代码解释器和文本生图像)以完成复杂的任务。', displayName: 'GLM-4-AllTools', enabled: true, functionCall: true, @@ -50,7 +51,8 @@ const ZhiPu: ModelProviderCard = { tokens: 128_000, }, { - description: '实现了视觉语言特征的深度融合,支持视觉问答、图像字幕、视觉定位、复杂目标检测等各类图像理解任务', + description: + '实现了视觉语言特征的深度融合,支持视觉问答、图像字幕、视觉定位、复杂目标检测等各类图像理解任务', displayName: 'GLM-4V', enabled: true, id: 'glm-4v', @@ -58,14 +60,16 @@ const ZhiPu: ModelProviderCard = { vision: true, }, { - description: '适用于对知识量、推理能力、创造力要求较高的场景,比如广告文案、小说写作、知识类写作、代码生成等', + description: + '适用于对知识量、推理能力、创造力要求较高的场景,比如广告文案、小说写作、知识类写作、代码生成等', // Will be discontinued on December 31, 2024 displayName: 'GLM-3-Turbo', functionCall: true, id: 'glm-3-turbo', tokens: 128_000, }, { - description: 'CodeGeeX是一款强大的AI编程助手,提供智能问答和代码补全功能,支持多种编程语言,帮助开发者提高编程效率。', + description: + 'CodeGeeX是一款强大的AI编程助手,提供智能问答和代码补全功能,支持多种编程语言,帮助开发者提高编程效率。', displayName: 'CodeGeeX-4', enabled: true, functionCall: false, diff --git a/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap b/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap index 4fcb10f81af0..9bc50e9eef48 100644 --- a/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap +++ b/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap @@ -3,7 +3,7 @@ exports[`LobeOpenAI > models > should get models 1`] = ` [ { - "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务", + "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125", "displayName": "GPT-3.5 Turbo", "functionCall": true, "id": "gpt-3.5-turbo", @@ -17,7 +17,7 @@ exports[`LobeOpenAI > models > should get models 1`] = ` "tokens": 16385, }, { - "displayName": "GPT-3.5 Turbo 16K (0613)", + "description": "Currently points to gpt-3.5-turbo-16k-0613", "id": "gpt-3.5-turbo-16k-0613", "legacy": true, "tokens": 16385, diff --git a/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap b/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap index 6c943f5e2209..c9727a8360f4 100644 --- a/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +++ b/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap @@ -59,7 +59,7 @@ Updated by OpenAI to point to the [latest version of GPT-3.5](/models?q=openai/g Usage of Gemma is subject to Google's [Gemma Terms of Use](https://ai.google.dev/gemma/terms).", "displayName": "Google: Gemma 7B", - "enabled": true, + "enabled": false, "functionCall": false, "id": "google/gemma-7b-it", "maxTokens": undefined, diff --git a/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap b/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap index fb029458090a..f6b09c6e1247 100644 --- a/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap +++ b/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap @@ -135,7 +135,7 @@ exports[`LobeTogetherAI > models > should get models 1`] = ` { "description": "Qwen1.5 is the beta version of Qwen2, a transformer-based decoder-only language model pretrained on a large amount of data. In comparison with the previous released Qwen.", "displayName": "Qwen 1.5 Chat (14B)", - "enabled": true, + "enabled": false, "functionCall": false, "id": "Qwen/Qwen1.5-14B-Chat", "maxOutput": 32768, @@ -145,7 +145,7 @@ exports[`LobeTogetherAI > models > should get models 1`] = ` { "description": "Qwen1.5 is the beta version of Qwen2, a transformer-based decoder-only language model pretrained on a large amount of data. In comparison with the previous released Qwen.", "displayName": "Qwen 1.5 Chat (32B)", - "enabled": false, + "enabled": true, "functionCall": false, "id": "Qwen/Qwen1.5-32B-Chat", "maxOutput": 32768, @@ -335,7 +335,7 @@ exports[`LobeTogetherAI > models > should get models 1`] = ` { "description": "Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models.", "displayName": "Gemma Instruct (7B)", - "enabled": true, + "enabled": false, "functionCall": false, "id": "google/gemma-7b-it", "maxOutput": 8192, diff --git a/src/server/routers/edge/config/__snapshots__/index.test.ts.snap b/src/server/routers/edge/config/__snapshots__/index.test.ts.snap index c614e9322e45..ba73e371274f 100644 --- a/src/server/routers/edge/config/__snapshots__/index.test.ts.snap +++ b/src/server/routers/edge/config/__snapshots__/index.test.ts.snap @@ -40,7 +40,7 @@ exports[`configRouter > getGlobalConfig > Model Provider env > OPENAI_MODEL_LIST "tokens": 16385, }, { - "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务", + "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125", "displayName": "GPT-3.5 Turbo", "enabled": true, "functionCall": true,