@lobehub/chat 1.51.7 → 1.51.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.ja-JP.md +8 -8
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/src/app/(backend)/webapi/chat/models/[provider]/route.ts +1 -1
- package/src/libs/agent-runtime/ai360/index.ts +8 -1
- package/src/libs/agent-runtime/anthropic/index.ts +2 -1
- package/src/libs/agent-runtime/baichuan/index.ts +1 -1
- package/src/libs/agent-runtime/cloudflare/index.test.ts +0 -117
- package/src/libs/agent-runtime/cloudflare/index.ts +32 -11
- package/src/libs/agent-runtime/deepseek/index.ts +4 -1
- package/src/libs/agent-runtime/fireworksai/index.ts +8 -1
- package/src/libs/agent-runtime/giteeai/index.ts +9 -1
- package/src/libs/agent-runtime/github/index.test.ts +5 -16
- package/src/libs/agent-runtime/github/index.ts +31 -33
- package/src/libs/agent-runtime/google/index.ts +2 -1
- package/src/libs/agent-runtime/groq/index.ts +7 -1
- package/src/libs/agent-runtime/higress/index.ts +2 -1
- package/src/libs/agent-runtime/huggingface/index.ts +10 -1
- package/src/libs/agent-runtime/hunyuan/index.ts +3 -1
- package/src/libs/agent-runtime/internlm/index.ts +3 -1
- package/src/libs/agent-runtime/mistral/index.ts +2 -1
- package/src/libs/agent-runtime/moonshot/index.ts +3 -1
- package/src/libs/agent-runtime/novita/__snapshots__/index.test.ts.snap +48 -12
- package/src/libs/agent-runtime/novita/index.ts +9 -1
- package/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap +70 -66
- package/src/libs/agent-runtime/openai/index.ts +37 -0
- package/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +172 -4
- package/src/libs/agent-runtime/openrouter/index.ts +17 -2
- package/src/libs/agent-runtime/qwen/index.ts +10 -1
- package/src/libs/agent-runtime/sensenova/index.ts +3 -1
- package/src/libs/agent-runtime/siliconcloud/index.ts +10 -1
- package/src/libs/agent-runtime/stepfun/index.ts +3 -1
- package/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap +1309 -5
- package/src/libs/agent-runtime/togetherai/index.test.ts +0 -13
- package/src/libs/agent-runtime/togetherai/index.ts +25 -20
- package/src/libs/agent-runtime/utils/cloudflareHelpers.test.ts +0 -99
- package/src/libs/agent-runtime/utils/cloudflareHelpers.ts +0 -70
- package/src/libs/agent-runtime/xai/index.ts +3 -1
- package/src/libs/agent-runtime/zeroone/index.ts +3 -1
- package/src/libs/agent-runtime/zhipu/index.ts +3 -1
@@ -62,6 +62,12 @@ export const LobeHuggingFaceAI = LobeOpenAICompatibleFactory({
|
|
62
62
|
'vision',
|
63
63
|
];
|
64
64
|
|
65
|
+
const reasoningKeywords = [
|
66
|
+
'deepseek-r1',
|
67
|
+
'qvq',
|
68
|
+
'qwq',
|
69
|
+
];
|
70
|
+
|
65
71
|
// ref: https://huggingface.co/docs/hub/api
|
66
72
|
const url = 'https://huggingface.co/api/models';
|
67
73
|
const response = await fetch(url, {
|
@@ -74,9 +80,12 @@ export const LobeHuggingFaceAI = LobeOpenAICompatibleFactory({
|
|
74
80
|
return modelList
|
75
81
|
.map((model) => {
|
76
82
|
return {
|
77
|
-
|
83
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
84
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
85
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
78
86
|
functionCall: model.tags.some(tag => tag.toLowerCase().includes('function-calling')),
|
79
87
|
id: model.id,
|
88
|
+
reasoning: model.tags.some(tag => tag.toLowerCase().includes('reasoning')) || reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
|
80
89
|
vision: model.tags.some(tag =>
|
81
90
|
visionKeywords.some(keyword => tag.toLowerCase().includes(keyword))
|
82
91
|
),
|
@@ -23,7 +23,9 @@ export const LobeHunyuanAI = LobeOpenAICompatibleFactory({
|
|
23
23
|
const model = m as unknown as HunyuanModelCard;
|
24
24
|
|
25
25
|
return {
|
26
|
-
|
26
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
27
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
28
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
27
29
|
functionCall: functionCallKeywords.some(keyword => model.id.toLowerCase().includes(keyword)) && !model.id.toLowerCase().includes('vision'),
|
28
30
|
id: model.id,
|
29
31
|
vision: model.id.toLowerCase().includes('vision'),
|
@@ -25,7 +25,9 @@ export const LobeInternLMAI = LobeOpenAICompatibleFactory({
|
|
25
25
|
const model = m as unknown as InternLMModelCard;
|
26
26
|
|
27
27
|
return {
|
28
|
-
|
28
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
29
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
30
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
29
31
|
functionCall: true,
|
30
32
|
id: model.id,
|
31
33
|
};
|
@@ -37,7 +37,8 @@ export const LobeMistralAI = LobeOpenAICompatibleFactory({
|
|
37
37
|
return {
|
38
38
|
contextWindowTokens: model.max_context_length,
|
39
39
|
description: model.description,
|
40
|
-
|
40
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
41
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
41
42
|
functionCall: model.capabilities.function_calling,
|
42
43
|
id: model.id,
|
43
44
|
vision: model.capabilities.vision,
|
@@ -29,7 +29,9 @@ export const LobeMoonshotAI = LobeOpenAICompatibleFactory({
|
|
29
29
|
const model = m as unknown as MoonshotModelCard;
|
30
30
|
|
31
31
|
return {
|
32
|
-
|
32
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
33
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
34
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
33
35
|
functionCall: true,
|
34
36
|
id: model.id,
|
35
37
|
vision: model.id.toLowerCase().includes('vision'),
|
@@ -6,17 +6,21 @@ exports[`NovitaAI > models > should get models 1`] = `
|
|
6
6
|
"contextWindowTokens": 8192,
|
7
7
|
"description": "Meta's latest class of model (Llama 3) launched with a variety of sizes & flavors. This 8B instruct-tuned version was optimized for high quality dialogue usecases. It has demonstrated strong performance compared to leading closed-source models in human evaluations.",
|
8
8
|
"displayName": "meta-llama/llama-3-8b-instruct",
|
9
|
-
"enabled":
|
9
|
+
"enabled": false,
|
10
10
|
"functionCall": false,
|
11
11
|
"id": "meta-llama/llama-3-8b-instruct",
|
12
|
+
"reasoning": false,
|
13
|
+
"vision": false,
|
12
14
|
},
|
13
15
|
{
|
14
16
|
"contextWindowTokens": 8192,
|
15
17
|
"description": "Meta's latest class of model (Llama 3) launched with a variety of sizes & flavors. This 70B instruct-tuned version was optimized for high quality dialogue usecases. It has demonstrated strong performance compared to leading closed-source models in human evaluations.",
|
16
18
|
"displayName": "meta-llama/llama-3-70b-instruct",
|
17
|
-
"enabled":
|
19
|
+
"enabled": false,
|
18
20
|
"functionCall": false,
|
19
21
|
"id": "meta-llama/llama-3-70b-instruct",
|
22
|
+
"reasoning": false,
|
23
|
+
"vision": false,
|
20
24
|
},
|
21
25
|
{
|
22
26
|
"contextWindowTokens": 8192,
|
@@ -25,6 +29,8 @@ exports[`NovitaAI > models > should get models 1`] = `
|
|
25
29
|
"enabled": true,
|
26
30
|
"functionCall": false,
|
27
31
|
"id": "meta-llama/llama-3.1-8b-instruct",
|
32
|
+
"reasoning": false,
|
33
|
+
"vision": false,
|
28
34
|
},
|
29
35
|
{
|
30
36
|
"contextWindowTokens": 8192,
|
@@ -33,6 +39,8 @@ exports[`NovitaAI > models > should get models 1`] = `
|
|
33
39
|
"enabled": true,
|
34
40
|
"functionCall": false,
|
35
41
|
"id": "meta-llama/llama-3.1-70b-instruct",
|
42
|
+
"reasoning": false,
|
43
|
+
"vision": false,
|
36
44
|
},
|
37
45
|
{
|
38
46
|
"contextWindowTokens": 32768,
|
@@ -41,6 +49,8 @@ exports[`NovitaAI > models > should get models 1`] = `
|
|
41
49
|
"enabled": true,
|
42
50
|
"functionCall": false,
|
43
51
|
"id": "meta-llama/llama-3.1-405b-instruct",
|
52
|
+
"reasoning": false,
|
53
|
+
"vision": false,
|
44
54
|
},
|
45
55
|
{
|
46
56
|
"contextWindowTokens": 8192,
|
@@ -50,22 +60,28 @@ Designed for a wide variety of tasks, it empowers developers and researchers to
|
|
50
60
|
"enabled": true,
|
51
61
|
"functionCall": false,
|
52
62
|
"id": "google/gemma-2-9b-it",
|
63
|
+
"reasoning": false,
|
64
|
+
"vision": false,
|
53
65
|
},
|
54
66
|
{
|
55
67
|
"contextWindowTokens": 4096,
|
56
68
|
"description": "This is a fine-tuned Llama-2 model designed to support longer and more detailed writing prompts, as well as next-chapter generation. It also includes an experimental role-playing instruction set with multi-round dialogues, character interactions, and varying numbers of participants",
|
57
69
|
"displayName": "jondurbin/airoboros-l2-70b",
|
58
|
-
"enabled":
|
70
|
+
"enabled": false,
|
59
71
|
"functionCall": false,
|
60
72
|
"id": "jondurbin/airoboros-l2-70b",
|
73
|
+
"reasoning": false,
|
74
|
+
"vision": false,
|
61
75
|
},
|
62
76
|
{
|
63
77
|
"contextWindowTokens": 8192,
|
64
78
|
"description": "Hermes 2 Pro is an upgraded, retrained version of Nous Hermes 2, consisting of an updated and cleaned version of the OpenHermes 2.5 Dataset, as well as a newly introduced Function Calling and JSON Mode dataset developed in-house.",
|
65
79
|
"displayName": "nousresearch/hermes-2-pro-llama-3-8b",
|
66
|
-
"enabled":
|
80
|
+
"enabled": false,
|
67
81
|
"functionCall": true,
|
68
82
|
"id": "nousresearch/hermes-2-pro-llama-3-8b",
|
83
|
+
"reasoning": false,
|
84
|
+
"vision": false,
|
69
85
|
},
|
70
86
|
{
|
71
87
|
"contextWindowTokens": 32768,
|
@@ -74,70 +90,88 @@ Designed for a wide variety of tasks, it empowers developers and researchers to
|
|
74
90
|
"enabled": true,
|
75
91
|
"functionCall": false,
|
76
92
|
"id": "mistralai/mistral-7b-instruct",
|
93
|
+
"reasoning": false,
|
94
|
+
"vision": false,
|
77
95
|
},
|
78
96
|
{
|
79
97
|
"contextWindowTokens": 16000,
|
80
98
|
"description": "Dolphin 2.9 is designed for instruction following, conversational, and coding. This model is a finetune of Mixtral 8x22B Instruct. It features a 64k context length and was fine-tuned with a 16k sequence length using ChatML templates.The model is uncensored and is stripped of alignment and bias. It requires an external alignment layer for ethical use.",
|
81
99
|
"displayName": "cognitivecomputations/dolphin-mixtral-8x22b",
|
82
|
-
"enabled":
|
100
|
+
"enabled": false,
|
83
101
|
"functionCall": false,
|
84
102
|
"id": "cognitivecomputations/dolphin-mixtral-8x22b",
|
103
|
+
"reasoning": false,
|
104
|
+
"vision": false,
|
85
105
|
},
|
86
106
|
{
|
87
107
|
"contextWindowTokens": 16000,
|
88
108
|
"description": "The uncensored llama3 model is a powerhouse of creativity, excelling in both roleplay and story writing. It offers a liberating experience during roleplays, free from any restrictions. This model stands out for its immense creativity, boasting a vast array of unique ideas and plots, truly a treasure trove for those seeking originality. Its unrestricted nature during roleplays allows for the full breadth of imagination to unfold, akin to an enhanced, big-brained version of Stheno. Perfect for creative minds seeking a boundless platform for their imaginative expressions, the uncensored llama3 model is an ideal choice",
|
89
109
|
"displayName": "sao10k/l3-70b-euryale-v2.1",
|
90
|
-
"enabled":
|
110
|
+
"enabled": false,
|
91
111
|
"functionCall": false,
|
92
112
|
"id": "sao10k/l3-70b-euryale-v2.1",
|
113
|
+
"reasoning": false,
|
114
|
+
"vision": false,
|
93
115
|
},
|
94
116
|
{
|
95
117
|
"contextWindowTokens": 4096,
|
96
118
|
"description": "A merge with a complex family tree, this model was crafted for roleplaying and storytelling. Midnight Rose is a successor to Rogue Rose and Aurora Nights and improves upon them both. It wants to produce lengthy output by default and is the best creative writing merge produced so far by sophosympatheia.",
|
97
119
|
"displayName": "sophosympatheia/midnight-rose-70b",
|
98
|
-
"enabled":
|
120
|
+
"enabled": false,
|
99
121
|
"functionCall": false,
|
100
122
|
"id": "sophosympatheia/midnight-rose-70b",
|
123
|
+
"reasoning": false,
|
124
|
+
"vision": false,
|
101
125
|
},
|
102
126
|
{
|
103
127
|
"contextWindowTokens": 4096,
|
104
128
|
"description": "The idea behind this merge is that each layer is composed of several tensors, which are in turn responsible for specific functions. Using MythoLogic-L2's robust understanding as its input and Huginn's extensive writing capability as its output seems to have resulted in a model that exceeds at both, confirming my theory. (More details to be released at a later time).",
|
105
129
|
"displayName": "gryphe/mythomax-l2-13b",
|
106
|
-
"enabled":
|
130
|
+
"enabled": false,
|
107
131
|
"functionCall": false,
|
108
132
|
"id": "gryphe/mythomax-l2-13b",
|
133
|
+
"reasoning": false,
|
134
|
+
"vision": false,
|
109
135
|
},
|
110
136
|
{
|
111
137
|
"contextWindowTokens": 4096,
|
112
138
|
"description": "Nous-Hermes-Llama2-13b is a state-of-the-art language model fine-tuned on over 300,000 instructions. This model was fine-tuned by Nous Research, with Teknium and Emozilla leading the fine tuning process and dataset curation, Redmond AI sponsoring the compute, and several other contributors.",
|
113
139
|
"displayName": "nousresearch/nous-hermes-llama2-13b",
|
114
|
-
"enabled":
|
140
|
+
"enabled": false,
|
115
141
|
"functionCall": false,
|
116
142
|
"id": "nousresearch/nous-hermes-llama2-13b",
|
143
|
+
"reasoning": false,
|
144
|
+
"vision": false,
|
117
145
|
},
|
118
146
|
{
|
119
147
|
"contextWindowTokens": 32768,
|
120
148
|
"description": "Nous Hermes 2 Mixtral 8x7B DPO is the new flagship Nous Research model trained over the Mixtral 8x7B MoE LLM. The model was trained on over 1,000,000 entries of primarily GPT-4 generated data, as well as other high quality data from open datasets across the AI landscape, achieving state of the art performance on a variety of tasks.",
|
121
149
|
"displayName": "Nous-Hermes-2-Mixtral-8x7B-DPO",
|
122
|
-
"enabled":
|
150
|
+
"enabled": false,
|
123
151
|
"functionCall": false,
|
124
152
|
"id": "Nous-Hermes-2-Mixtral-8x7B-DPO",
|
153
|
+
"reasoning": false,
|
154
|
+
"vision": false,
|
125
155
|
},
|
126
156
|
{
|
127
157
|
"contextWindowTokens": 4096,
|
128
158
|
"description": "A Mythomax/MLewd_13B-style merge of selected 70B models. A multi-model merge of several LLaMA2 70B finetunes for roleplaying and creative work. The goal was to create a model that combines creativity with intelligence for an enhanced experience.",
|
129
159
|
"displayName": "lzlv_70b",
|
130
|
-
"enabled":
|
160
|
+
"enabled": false,
|
131
161
|
"functionCall": false,
|
132
162
|
"id": "lzlv_70b",
|
163
|
+
"reasoning": false,
|
164
|
+
"vision": false,
|
133
165
|
},
|
134
166
|
{
|
135
167
|
"contextWindowTokens": 4096,
|
136
168
|
"description": "OpenHermes 2.5 Mistral 7B is a state of the art Mistral Fine-tune, a continuation of OpenHermes 2 model, which trained on additional code datasets.",
|
137
169
|
"displayName": "teknium/openhermes-2.5-mistral-7b",
|
138
|
-
"enabled":
|
170
|
+
"enabled": false,
|
139
171
|
"functionCall": false,
|
140
172
|
"id": "teknium/openhermes-2.5-mistral-7b",
|
173
|
+
"reasoning": false,
|
174
|
+
"vision": false,
|
141
175
|
},
|
142
176
|
{
|
143
177
|
"contextWindowTokens": 65535,
|
@@ -146,6 +180,8 @@ Designed for a wide variety of tasks, it empowers developers and researchers to
|
|
146
180
|
"enabled": true,
|
147
181
|
"functionCall": false,
|
148
182
|
"id": "microsoft/wizardlm-2-8x22b",
|
183
|
+
"reasoning": false,
|
184
|
+
"vision": false,
|
149
185
|
},
|
150
186
|
]
|
151
187
|
`;
|
@@ -2,6 +2,8 @@ import { ModelProvider } from '../types';
|
|
2
2
|
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
|
3
3
|
import { NovitaModelCard } from './type';
|
4
4
|
|
5
|
+
import { LOBE_DEFAULT_MODEL_LIST } from '@/config/aiModels';
|
6
|
+
|
5
7
|
export const LobeNovitaAI = LobeOpenAICompatibleFactory({
|
6
8
|
baseURL: 'https://api.novita.ai/v3/openai',
|
7
9
|
constructorOptions: {
|
@@ -14,15 +16,21 @@ export const LobeNovitaAI = LobeOpenAICompatibleFactory({
|
|
14
16
|
},
|
15
17
|
models: {
|
16
18
|
transformModel: (m) => {
|
19
|
+
const reasoningKeywords = [
|
20
|
+
'deepseek-r1',
|
21
|
+
];
|
22
|
+
|
17
23
|
const model = m as unknown as NovitaModelCard;
|
18
24
|
|
19
25
|
return {
|
20
26
|
contextWindowTokens: model.context_size,
|
21
27
|
description: model.description,
|
22
28
|
displayName: model.title,
|
23
|
-
enabled: model.
|
29
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
24
30
|
functionCall: model.description.toLowerCase().includes('function calling'),
|
25
31
|
id: model.id,
|
32
|
+
reasoning: model.description.toLowerCase().includes('reasoning task') || reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
|
33
|
+
vision: model.description.toLowerCase().includes('vision'),
|
26
34
|
};
|
27
35
|
},
|
28
36
|
},
|
@@ -4,143 +4,147 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
4
4
|
[
|
5
5
|
{
|
6
6
|
"contextWindowTokens": 16385,
|
7
|
-
"
|
8
|
-
"
|
7
|
+
"displayName": "GPT 3.5 Turbo",
|
8
|
+
"enabled": true,
|
9
9
|
"functionCall": true,
|
10
10
|
"id": "gpt-3.5-turbo",
|
11
|
-
"
|
12
|
-
|
13
|
-
"output": 1.5,
|
14
|
-
},
|
15
|
-
"releasedAt": "2023-02-28",
|
11
|
+
"reasoning": false,
|
12
|
+
"vision": false,
|
16
13
|
},
|
17
14
|
{
|
15
|
+
"contextWindowTokens": 16384,
|
16
|
+
"displayName": "GPT 3.5 Turbo",
|
17
|
+
"enabled": false,
|
18
|
+
"functionCall": true,
|
18
19
|
"id": "gpt-3.5-turbo-16k",
|
19
|
-
"
|
20
|
+
"reasoning": false,
|
21
|
+
"vision": false,
|
20
22
|
},
|
21
23
|
{
|
24
|
+
"contextWindowTokens": undefined,
|
25
|
+
"displayName": undefined,
|
26
|
+
"enabled": false,
|
27
|
+
"functionCall": true,
|
22
28
|
"id": "gpt-3.5-turbo-16k-0613",
|
23
|
-
"
|
29
|
+
"reasoning": false,
|
30
|
+
"vision": false,
|
24
31
|
},
|
25
32
|
{
|
33
|
+
"contextWindowTokens": undefined,
|
34
|
+
"displayName": undefined,
|
35
|
+
"enabled": false,
|
36
|
+
"functionCall": true,
|
26
37
|
"id": "gpt-4-1106-vision-preview",
|
27
|
-
"
|
38
|
+
"reasoning": false,
|
39
|
+
"vision": true,
|
28
40
|
},
|
29
41
|
{
|
42
|
+
"contextWindowTokens": undefined,
|
43
|
+
"displayName": undefined,
|
44
|
+
"enabled": false,
|
45
|
+
"functionCall": true,
|
30
46
|
"id": "gpt-3.5-turbo-instruct-0914",
|
31
|
-
"
|
47
|
+
"reasoning": false,
|
48
|
+
"vision": false,
|
32
49
|
},
|
33
50
|
{
|
34
51
|
"contextWindowTokens": 128000,
|
35
|
-
"description": "最新的 GPT-4 Turbo 模型具备视觉功能。现在,视觉请求可以使用 JSON 模式和函数调用。 GPT-4 Turbo 是一个增强版本,为多模态任务提供成本效益高的支持。它在准确性和效率之间找到平衡,适合需要进行实时交互的应用程序场景。",
|
36
52
|
"displayName": "GPT-4 Turbo Preview 0125",
|
53
|
+
"enabled": false,
|
37
54
|
"functionCall": true,
|
38
55
|
"id": "gpt-4-0125-preview",
|
39
|
-
"
|
40
|
-
|
41
|
-
"output": 30,
|
42
|
-
},
|
43
|
-
"releasedAt": "2024-01-23",
|
56
|
+
"reasoning": false,
|
57
|
+
"vision": false,
|
44
58
|
},
|
45
59
|
{
|
46
60
|
"contextWindowTokens": 128000,
|
47
|
-
"description": "最新的 GPT-4 Turbo 模型具备视觉功能。现在,视觉请求可以使用 JSON 模式和函数调用。 GPT-4 Turbo 是一个增强版本,为多模态任务提供成本效益高的支持。它在准确性和效率之间找到平衡,适合需要进行实时交互的应用程序场景。",
|
48
61
|
"displayName": "GPT-4 Turbo Preview",
|
62
|
+
"enabled": false,
|
49
63
|
"functionCall": true,
|
50
64
|
"id": "gpt-4-turbo-preview",
|
51
|
-
"
|
52
|
-
|
53
|
-
"output": 30,
|
54
|
-
},
|
55
|
-
"releasedAt": "2024-01-23",
|
65
|
+
"reasoning": false,
|
66
|
+
"vision": false,
|
56
67
|
},
|
57
68
|
{
|
58
69
|
"contextWindowTokens": 4096,
|
59
|
-
"description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
|
60
70
|
"displayName": "GPT-3.5 Turbo Instruct",
|
71
|
+
"enabled": false,
|
72
|
+
"functionCall": true,
|
61
73
|
"id": "gpt-3.5-turbo-instruct",
|
62
|
-
"
|
63
|
-
|
64
|
-
"output": 2,
|
65
|
-
},
|
66
|
-
"releasedAt": "2023-08-24",
|
74
|
+
"reasoning": false,
|
75
|
+
"vision": false,
|
67
76
|
},
|
68
77
|
{
|
78
|
+
"contextWindowTokens": undefined,
|
79
|
+
"displayName": undefined,
|
80
|
+
"enabled": false,
|
81
|
+
"functionCall": true,
|
69
82
|
"id": "gpt-3.5-turbo-0301",
|
70
|
-
"
|
83
|
+
"reasoning": false,
|
84
|
+
"vision": false,
|
71
85
|
},
|
72
86
|
{
|
87
|
+
"contextWindowTokens": undefined,
|
88
|
+
"displayName": undefined,
|
89
|
+
"enabled": false,
|
90
|
+
"functionCall": true,
|
73
91
|
"id": "gpt-3.5-turbo-0613",
|
74
|
-
"
|
92
|
+
"reasoning": false,
|
93
|
+
"vision": false,
|
75
94
|
},
|
76
95
|
{
|
77
96
|
"contextWindowTokens": 16385,
|
78
|
-
"description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
|
79
97
|
"displayName": "GPT-3.5 Turbo 1106",
|
98
|
+
"enabled": false,
|
80
99
|
"functionCall": true,
|
81
100
|
"id": "gpt-3.5-turbo-1106",
|
82
|
-
"
|
83
|
-
|
84
|
-
"output": 2,
|
85
|
-
},
|
86
|
-
"releasedAt": "2023-11-02",
|
101
|
+
"reasoning": false,
|
102
|
+
"vision": false,
|
87
103
|
},
|
88
104
|
{
|
89
105
|
"contextWindowTokens": 128000,
|
90
|
-
"description": "最新的 GPT-4 Turbo 模型具备视觉功能。现在,视觉请求可以使用 JSON 模式和函数调用。 GPT-4 Turbo 是一个增强版本,为多模态任务提供成本效益高的支持。它在准确性和效率之间找到平衡,适合需要进行实时交互的应用程序场景。",
|
91
106
|
"displayName": "GPT-4 Turbo Preview 1106",
|
107
|
+
"enabled": false,
|
92
108
|
"functionCall": true,
|
93
109
|
"id": "gpt-4-1106-preview",
|
94
|
-
"
|
95
|
-
|
96
|
-
"output": 30,
|
97
|
-
},
|
98
|
-
"releasedAt": "2023-11-02",
|
110
|
+
"reasoning": false,
|
111
|
+
"vision": false,
|
99
112
|
},
|
100
113
|
{
|
101
114
|
"contextWindowTokens": 128000,
|
102
|
-
"deploymentName": "gpt-4-vision",
|
103
|
-
"description": "GPT-4 视觉预览版,专为图像分析和处理任务设计。",
|
104
115
|
"displayName": "GPT 4 Turbo with Vision Preview",
|
116
|
+
"enabled": false,
|
117
|
+
"functionCall": true,
|
105
118
|
"id": "gpt-4-vision-preview",
|
106
|
-
"
|
119
|
+
"reasoning": false,
|
107
120
|
"vision": true,
|
108
121
|
},
|
109
122
|
{
|
110
|
-
"contextWindowTokens":
|
111
|
-
"
|
112
|
-
"
|
123
|
+
"contextWindowTokens": 128000,
|
124
|
+
"displayName": "GPT 4 Turbo",
|
125
|
+
"enabled": true,
|
113
126
|
"functionCall": true,
|
114
127
|
"id": "gpt-4",
|
115
|
-
"
|
116
|
-
|
117
|
-
"output": 60,
|
118
|
-
},
|
119
|
-
"releasedAt": "2023-06-27",
|
128
|
+
"reasoning": false,
|
129
|
+
"vision": false,
|
120
130
|
},
|
121
131
|
{
|
122
132
|
"contextWindowTokens": 16385,
|
123
|
-
"description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
|
124
133
|
"displayName": "GPT-3.5 Turbo 0125",
|
134
|
+
"enabled": false,
|
125
135
|
"functionCall": true,
|
126
136
|
"id": "gpt-3.5-turbo-0125",
|
127
|
-
"
|
128
|
-
|
129
|
-
"output": 1.5,
|
130
|
-
},
|
131
|
-
"releasedAt": "2024-01-23",
|
137
|
+
"reasoning": false,
|
138
|
+
"vision": false,
|
132
139
|
},
|
133
140
|
{
|
134
141
|
"contextWindowTokens": 8192,
|
135
|
-
"description": "GPT-4 提供了一个更大的上下文窗口,能够处理更长的文本输入,适用于需要广泛信息整合和数据分析的场景。",
|
136
142
|
"displayName": "GPT-4 0613",
|
143
|
+
"enabled": false,
|
137
144
|
"functionCall": true,
|
138
145
|
"id": "gpt-4-0613",
|
139
|
-
"
|
140
|
-
|
141
|
-
"output": 60,
|
142
|
-
},
|
143
|
-
"releasedAt": "2023-06-12",
|
146
|
+
"reasoning": false,
|
147
|
+
"vision": false,
|
144
148
|
},
|
145
149
|
]
|
146
150
|
`;
|
@@ -1,6 +1,12 @@
|
|
1
1
|
import { ChatStreamPayload, ModelProvider, OpenAIChatMessage } from '../types';
|
2
2
|
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
|
3
3
|
|
4
|
+
import { LOBE_DEFAULT_MODEL_LIST } from '@/config/aiModels';
|
5
|
+
|
6
|
+
export interface OpenAIModelCard {
|
7
|
+
id: string;
|
8
|
+
}
|
9
|
+
|
4
10
|
export const pruneReasoningPayload = (payload: ChatStreamPayload) => {
|
5
11
|
// TODO: 临时写法,后续要重构成 model card 展示配置
|
6
12
|
const disableStreamModels = new Set([
|
@@ -49,5 +55,36 @@ export const LobeOpenAI = LobeOpenAICompatibleFactory({
|
|
49
55
|
debug: {
|
50
56
|
chatCompletion: () => process.env.DEBUG_OPENAI_CHAT_COMPLETION === '1',
|
51
57
|
},
|
58
|
+
models: {
|
59
|
+
transformModel: (m) => {
|
60
|
+
const functionCallKeywords = [
|
61
|
+
'gpt-4',
|
62
|
+
'gpt-3.5',
|
63
|
+
'o3-mini',
|
64
|
+
];
|
65
|
+
|
66
|
+
const visionKeywords = [
|
67
|
+
'gpt-4o',
|
68
|
+
'vision',
|
69
|
+
];
|
70
|
+
|
71
|
+
const reasoningKeywords = [
|
72
|
+
'o1',
|
73
|
+
'o3',
|
74
|
+
];
|
75
|
+
|
76
|
+
const model = m as unknown as OpenAIModelCard;
|
77
|
+
|
78
|
+
return {
|
79
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
80
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
81
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
82
|
+
functionCall: functionCallKeywords.some(keyword => model.id.toLowerCase().includes(keyword)) && !model.id.toLowerCase().includes('audio'),
|
83
|
+
id: model.id,
|
84
|
+
reasoning: reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
|
85
|
+
vision: visionKeywords.some(keyword => model.id.toLowerCase().includes(keyword)) && !model.id.toLowerCase().includes('audio'),
|
86
|
+
};
|
87
|
+
},
|
88
|
+
},
|
52
89
|
provider: ModelProvider.OpenAI,
|
53
90
|
});
|