librechat-data-provider 0.7.41 → 0.7.52
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/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/dist/react-query/package.json +1 -1
- package/package.json +3 -3
- package/react-query/package.json +1 -1
- package/specs/actions.spec.ts +575 -29
- package/specs/openapiSpecs.ts +127 -0
- package/src/actions.ts +207 -61
- package/src/api-endpoints.ts +22 -2
- package/src/artifacts.ts +3104 -0
- package/src/bedrock.ts +147 -0
- package/src/config.ts +174 -22
- package/src/data-service.ts +218 -75
- package/src/file-config.ts +4 -1
- package/src/generate.ts +30 -1
- package/src/index.ts +5 -0
- package/src/keys.ts +10 -0
- package/src/parsers.ts +85 -27
- package/src/react-query/react-query-service.ts +32 -7
- package/src/request.ts +3 -0
- package/src/roles.ts +59 -2
- package/src/schemas.ts +293 -184
- package/src/types/agents.ts +220 -0
- package/src/types/assistants.ts +152 -27
- package/src/types/files.ts +6 -0
- package/src/types/mutations.ts +72 -0
- package/src/types/queries.ts +14 -11
- package/src/types/runs.ts +22 -0
- package/src/types.ts +35 -4
package/src/bedrock.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as s from './schemas';
|
|
3
|
+
|
|
4
|
+
export const bedrockInputSchema = s.tConversationSchema
|
|
5
|
+
.pick({
|
|
6
|
+
/* LibreChat params; optionType: 'conversation' */
|
|
7
|
+
modelLabel: true,
|
|
8
|
+
promptPrefix: true,
|
|
9
|
+
resendFiles: true,
|
|
10
|
+
iconURL: true,
|
|
11
|
+
greeting: true,
|
|
12
|
+
spec: true,
|
|
13
|
+
maxOutputTokens: true,
|
|
14
|
+
maxContextTokens: true,
|
|
15
|
+
artifacts: true,
|
|
16
|
+
/* Bedrock params; optionType: 'model' */
|
|
17
|
+
region: true,
|
|
18
|
+
system: true,
|
|
19
|
+
model: true,
|
|
20
|
+
maxTokens: true,
|
|
21
|
+
temperature: true,
|
|
22
|
+
topP: true,
|
|
23
|
+
stop: true,
|
|
24
|
+
/* Catch-all fields */
|
|
25
|
+
topK: true,
|
|
26
|
+
additionalModelRequestFields: true,
|
|
27
|
+
})
|
|
28
|
+
.transform(s.removeNullishValues)
|
|
29
|
+
.catch(() => ({}));
|
|
30
|
+
|
|
31
|
+
export type BedrockConverseInput = z.infer<typeof bedrockInputSchema>;
|
|
32
|
+
|
|
33
|
+
export const bedrockInputParser = s.tConversationSchema
|
|
34
|
+
.pick({
|
|
35
|
+
/* LibreChat params; optionType: 'conversation' */
|
|
36
|
+
modelLabel: true,
|
|
37
|
+
promptPrefix: true,
|
|
38
|
+
resendFiles: true,
|
|
39
|
+
iconURL: true,
|
|
40
|
+
greeting: true,
|
|
41
|
+
spec: true,
|
|
42
|
+
artifacts: true,
|
|
43
|
+
maxOutputTokens: true,
|
|
44
|
+
maxContextTokens: true,
|
|
45
|
+
/* Bedrock params; optionType: 'model' */
|
|
46
|
+
region: true,
|
|
47
|
+
model: true,
|
|
48
|
+
maxTokens: true,
|
|
49
|
+
temperature: true,
|
|
50
|
+
topP: true,
|
|
51
|
+
stop: true,
|
|
52
|
+
/* Catch-all fields */
|
|
53
|
+
topK: true,
|
|
54
|
+
additionalModelRequestFields: true,
|
|
55
|
+
})
|
|
56
|
+
.catchall(z.any())
|
|
57
|
+
.transform((data) => {
|
|
58
|
+
const knownKeys = [
|
|
59
|
+
'modelLabel',
|
|
60
|
+
'promptPrefix',
|
|
61
|
+
'resendFiles',
|
|
62
|
+
'iconURL',
|
|
63
|
+
'greeting',
|
|
64
|
+
'spec',
|
|
65
|
+
'maxOutputTokens',
|
|
66
|
+
'artifacts',
|
|
67
|
+
'additionalModelRequestFields',
|
|
68
|
+
'region',
|
|
69
|
+
'model',
|
|
70
|
+
'maxTokens',
|
|
71
|
+
'temperature',
|
|
72
|
+
'topP',
|
|
73
|
+
'stop',
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const additionalFields: Record<string, unknown> = {};
|
|
77
|
+
const typedData = data as Record<string, unknown>;
|
|
78
|
+
|
|
79
|
+
Object.entries(typedData).forEach(([key, value]) => {
|
|
80
|
+
if (!knownKeys.includes(key)) {
|
|
81
|
+
if (key === 'topK') {
|
|
82
|
+
additionalFields['top_k'] = value;
|
|
83
|
+
} else {
|
|
84
|
+
additionalFields[key] = value;
|
|
85
|
+
}
|
|
86
|
+
delete typedData[key];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (Object.keys(additionalFields).length > 0) {
|
|
91
|
+
typedData.additionalModelRequestFields = {
|
|
92
|
+
...((typedData.additionalModelRequestFields as Record<string, unknown> | undefined) || {}),
|
|
93
|
+
...additionalFields,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (typedData.maxOutputTokens !== undefined) {
|
|
98
|
+
typedData.maxTokens = typedData.maxOutputTokens;
|
|
99
|
+
} else if (typedData.maxTokens !== undefined) {
|
|
100
|
+
typedData.maxOutputTokens = typedData.maxTokens;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return s.removeNullishValues(typedData) as BedrockConverseInput;
|
|
104
|
+
})
|
|
105
|
+
.catch(() => ({}));
|
|
106
|
+
|
|
107
|
+
export const bedrockOutputParser = (data: Record<string, unknown>) => {
|
|
108
|
+
const knownKeys = [...Object.keys(s.tConversationSchema.shape), 'topK', 'top_k'];
|
|
109
|
+
const result: Record<string, unknown> = {};
|
|
110
|
+
|
|
111
|
+
// Extract known fields from the root level
|
|
112
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
113
|
+
if (knownKeys.includes(key)) {
|
|
114
|
+
result[key] = value;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Extract known fields from additionalModelRequestFields
|
|
119
|
+
if (
|
|
120
|
+
typeof data.additionalModelRequestFields === 'object' &&
|
|
121
|
+
data.additionalModelRequestFields !== null
|
|
122
|
+
) {
|
|
123
|
+
Object.entries(data.additionalModelRequestFields as Record<string, unknown>).forEach(
|
|
124
|
+
([key, value]) => {
|
|
125
|
+
if (knownKeys.includes(key)) {
|
|
126
|
+
if (key === 'top_k') {
|
|
127
|
+
result['topK'] = value;
|
|
128
|
+
} else {
|
|
129
|
+
result[key] = value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Handle maxTokens and maxOutputTokens
|
|
137
|
+
if (result.maxTokens !== undefined && result.maxOutputTokens === undefined) {
|
|
138
|
+
result.maxOutputTokens = result.maxTokens;
|
|
139
|
+
} else if (result.maxOutputTokens !== undefined && result.maxTokens === undefined) {
|
|
140
|
+
result.maxTokens = result.maxOutputTokens;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Remove additionalModelRequestFields from the result
|
|
144
|
+
delete result.additionalModelRequestFields;
|
|
145
|
+
|
|
146
|
+
return result;
|
|
147
|
+
};
|
package/src/config.ts
CHANGED
|
@@ -11,6 +11,11 @@ export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'd
|
|
|
11
11
|
|
|
12
12
|
export const defaultRetrievalModels = [
|
|
13
13
|
'gpt-4o',
|
|
14
|
+
'o1-preview-2024-09-12',
|
|
15
|
+
'o1-preview',
|
|
16
|
+
'o1-mini-2024-09-12',
|
|
17
|
+
'o1-mini',
|
|
18
|
+
'chatgpt-4o-latest',
|
|
14
19
|
'gpt-4o-2024-05-13',
|
|
15
20
|
'gpt-4o-2024-08-06',
|
|
16
21
|
'gpt-4o-mini',
|
|
@@ -134,6 +139,13 @@ export enum Capabilities {
|
|
|
134
139
|
tools = 'tools',
|
|
135
140
|
}
|
|
136
141
|
|
|
142
|
+
export enum AgentCapabilities {
|
|
143
|
+
execute_code = 'execute_code',
|
|
144
|
+
file_search = 'file_search',
|
|
145
|
+
actions = 'actions',
|
|
146
|
+
tools = 'tools',
|
|
147
|
+
}
|
|
148
|
+
|
|
137
149
|
export const defaultAssistantsVersion = {
|
|
138
150
|
[EModelEndpoint.assistants]: 2,
|
|
139
151
|
[EModelEndpoint.azureAssistants]: 1,
|
|
@@ -141,10 +153,19 @@ export const defaultAssistantsVersion = {
|
|
|
141
153
|
|
|
142
154
|
export const baseEndpointSchema = z.object({
|
|
143
155
|
streamRate: z.number().optional(),
|
|
156
|
+
baseURL: z.string().optional(),
|
|
157
|
+
titlePrompt: z.string().optional(),
|
|
158
|
+
titleModel: z.string().optional(),
|
|
144
159
|
});
|
|
145
160
|
|
|
146
161
|
export type TBaseEndpoint = z.infer<typeof baseEndpointSchema>;
|
|
147
162
|
|
|
163
|
+
export const bedrockEndpointSchema = baseEndpointSchema.merge(
|
|
164
|
+
z.object({
|
|
165
|
+
availableRegions: z.array(z.string()).optional(),
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
|
|
148
169
|
export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
149
170
|
z.object({
|
|
150
171
|
/* assistants specific */
|
|
@@ -168,7 +189,6 @@ export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
|
168
189
|
]),
|
|
169
190
|
/* general */
|
|
170
191
|
apiKey: z.string().optional(),
|
|
171
|
-
baseURL: z.string().optional(),
|
|
172
192
|
models: z
|
|
173
193
|
.object({
|
|
174
194
|
default: z.array(z.string()).min(1),
|
|
@@ -178,13 +198,50 @@ export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
|
178
198
|
.optional(),
|
|
179
199
|
titleConvo: z.boolean().optional(),
|
|
180
200
|
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
181
|
-
titleModel: z.string().optional(),
|
|
182
201
|
headers: z.record(z.any()).optional(),
|
|
183
202
|
}),
|
|
184
203
|
);
|
|
185
204
|
|
|
186
205
|
export type TAssistantEndpoint = z.infer<typeof assistantEndpointSchema>;
|
|
187
206
|
|
|
207
|
+
export const agentsEndpointSChema = baseEndpointSchema.merge(
|
|
208
|
+
z.object({
|
|
209
|
+
/* assistants specific */
|
|
210
|
+
disableBuilder: z.boolean().optional(),
|
|
211
|
+
pollIntervalMs: z.number().optional(),
|
|
212
|
+
timeoutMs: z.number().optional(),
|
|
213
|
+
version: z.union([z.string(), z.number()]).default(2),
|
|
214
|
+
supportedIds: z.array(z.string()).min(1).optional(),
|
|
215
|
+
excludedIds: z.array(z.string()).min(1).optional(),
|
|
216
|
+
privateAssistants: z.boolean().optional(),
|
|
217
|
+
retrievalModels: z.array(z.string()).min(1).optional().default(defaultRetrievalModels),
|
|
218
|
+
capabilities: z
|
|
219
|
+
.array(z.nativeEnum(Capabilities))
|
|
220
|
+
.optional()
|
|
221
|
+
.default([
|
|
222
|
+
Capabilities.code_interpreter,
|
|
223
|
+
Capabilities.image_vision,
|
|
224
|
+
Capabilities.retrieval,
|
|
225
|
+
Capabilities.actions,
|
|
226
|
+
Capabilities.tools,
|
|
227
|
+
]),
|
|
228
|
+
/* general */
|
|
229
|
+
apiKey: z.string().optional(),
|
|
230
|
+
models: z
|
|
231
|
+
.object({
|
|
232
|
+
default: z.array(z.string()).min(1),
|
|
233
|
+
fetch: z.boolean().optional(),
|
|
234
|
+
userIdQuery: z.boolean().optional(),
|
|
235
|
+
})
|
|
236
|
+
.optional(),
|
|
237
|
+
titleConvo: z.boolean().optional(),
|
|
238
|
+
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
239
|
+
headers: z.record(z.any()).optional(),
|
|
240
|
+
}),
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
export type TAgentsEndpoint = z.infer<typeof agentsEndpointSChema>;
|
|
244
|
+
|
|
188
245
|
export const endpointSchema = baseEndpointSchema.merge(
|
|
189
246
|
z.object({
|
|
190
247
|
name: z.string().refine((value) => !eModelEndpointSchema.safeParse(value).success, {
|
|
@@ -201,7 +258,6 @@ export const endpointSchema = baseEndpointSchema.merge(
|
|
|
201
258
|
}),
|
|
202
259
|
titleConvo: z.boolean().optional(),
|
|
203
260
|
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
204
|
-
titleModel: z.string().optional(),
|
|
205
261
|
summarize: z.boolean().optional(),
|
|
206
262
|
summaryModel: z.string().optional(),
|
|
207
263
|
forcePrompt: z.boolean().optional(),
|
|
@@ -406,13 +462,19 @@ export const configSchema = z.object({
|
|
|
406
462
|
.object({
|
|
407
463
|
externalUrl: z.string().optional(),
|
|
408
464
|
openNewTab: z.boolean().optional(),
|
|
465
|
+
modalAcceptance: z.boolean().optional(),
|
|
466
|
+
modalTitle: z.string().optional(),
|
|
467
|
+
modalContent: z.string().or(z.array(z.string())).optional(),
|
|
409
468
|
})
|
|
410
469
|
.optional(),
|
|
411
470
|
endpointsMenu: z.boolean().optional(),
|
|
412
471
|
modelSelect: z.boolean().optional(),
|
|
413
472
|
parameters: z.boolean().optional(),
|
|
414
473
|
sidePanel: z.boolean().optional(),
|
|
474
|
+
multiConvo: z.boolean().optional(),
|
|
475
|
+
bookmarks: z.boolean().optional(),
|
|
415
476
|
presets: z.boolean().optional(),
|
|
477
|
+
prompts: z.boolean().optional(),
|
|
416
478
|
})
|
|
417
479
|
.default({
|
|
418
480
|
endpointsMenu: true,
|
|
@@ -420,6 +482,9 @@ export const configSchema = z.object({
|
|
|
420
482
|
parameters: true,
|
|
421
483
|
sidePanel: true,
|
|
422
484
|
presets: true,
|
|
485
|
+
multiConvo: true,
|
|
486
|
+
bookmarks: true,
|
|
487
|
+
prompts: true,
|
|
423
488
|
}),
|
|
424
489
|
fileStrategy: fileSourceSchema.default(FileSources.local),
|
|
425
490
|
registration: z
|
|
@@ -448,7 +513,9 @@ export const configSchema = z.object({
|
|
|
448
513
|
[EModelEndpoint.azureOpenAI]: azureEndpointSchema.optional(),
|
|
449
514
|
[EModelEndpoint.azureAssistants]: assistantEndpointSchema.optional(),
|
|
450
515
|
[EModelEndpoint.assistants]: assistantEndpointSchema.optional(),
|
|
516
|
+
[EModelEndpoint.agents]: agentsEndpointSChema.optional(),
|
|
451
517
|
[EModelEndpoint.custom]: z.array(endpointSchema.partial()).optional(),
|
|
518
|
+
[EModelEndpoint.bedrock]: baseEndpointSchema.optional(),
|
|
452
519
|
})
|
|
453
520
|
.strict()
|
|
454
521
|
.refine((data) => Object.keys(data).length > 0, {
|
|
@@ -472,6 +539,7 @@ export enum KnownEndpoints {
|
|
|
472
539
|
apipie = 'apipie',
|
|
473
540
|
cohere = 'cohere',
|
|
474
541
|
fireworks = 'fireworks',
|
|
542
|
+
deepseek = 'deepseek',
|
|
475
543
|
groq = 'groq',
|
|
476
544
|
huggingface = 'huggingface',
|
|
477
545
|
mistral = 'mistral',
|
|
@@ -481,6 +549,7 @@ export enum KnownEndpoints {
|
|
|
481
549
|
perplexity = 'perplexity',
|
|
482
550
|
shuttleai = 'shuttleai',
|
|
483
551
|
'together.ai' = 'together.ai',
|
|
552
|
+
unify = 'unify',
|
|
484
553
|
}
|
|
485
554
|
|
|
486
555
|
export enum FetchTokenConfig {
|
|
@@ -492,17 +561,20 @@ export const defaultEndpoints: EModelEndpoint[] = [
|
|
|
492
561
|
EModelEndpoint.assistants,
|
|
493
562
|
EModelEndpoint.azureAssistants,
|
|
494
563
|
EModelEndpoint.azureOpenAI,
|
|
564
|
+
EModelEndpoint.agents,
|
|
495
565
|
EModelEndpoint.bingAI,
|
|
496
566
|
EModelEndpoint.chatGPTBrowser,
|
|
497
567
|
EModelEndpoint.gptPlugins,
|
|
498
568
|
EModelEndpoint.google,
|
|
499
569
|
EModelEndpoint.anthropic,
|
|
500
570
|
EModelEndpoint.custom,
|
|
571
|
+
EModelEndpoint.bedrock,
|
|
501
572
|
];
|
|
502
573
|
|
|
503
574
|
export const alternateName = {
|
|
504
575
|
[EModelEndpoint.openAI]: 'OpenAI',
|
|
505
576
|
[EModelEndpoint.assistants]: 'Assistants',
|
|
577
|
+
[EModelEndpoint.agents]: 'Agents',
|
|
506
578
|
[EModelEndpoint.azureAssistants]: 'Azure Assistants',
|
|
507
579
|
[EModelEndpoint.azureOpenAI]: 'Azure OpenAI',
|
|
508
580
|
[EModelEndpoint.bingAI]: 'Bing',
|
|
@@ -511,9 +583,13 @@ export const alternateName = {
|
|
|
511
583
|
[EModelEndpoint.google]: 'Google',
|
|
512
584
|
[EModelEndpoint.anthropic]: 'Anthropic',
|
|
513
585
|
[EModelEndpoint.custom]: 'Custom',
|
|
586
|
+
[EModelEndpoint.bedrock]: 'AWS Bedrock',
|
|
587
|
+
ollama: 'Ollama',
|
|
514
588
|
};
|
|
515
589
|
|
|
516
590
|
const sharedOpenAIModels = [
|
|
591
|
+
'gpt-4o-mini',
|
|
592
|
+
'gpt-4o',
|
|
517
593
|
'gpt-3.5-turbo',
|
|
518
594
|
'gpt-3.5-turbo-0125',
|
|
519
595
|
'gpt-4-turbo',
|
|
@@ -531,9 +607,59 @@ const sharedOpenAIModels = [
|
|
|
531
607
|
'gpt-3.5-turbo-0613',
|
|
532
608
|
];
|
|
533
609
|
|
|
610
|
+
const sharedAnthropicModels = [
|
|
611
|
+
'claude-3-5-sonnet-20241022',
|
|
612
|
+
'claude-3-5-sonnet-20240620',
|
|
613
|
+
'claude-3-5-sonnet-latest',
|
|
614
|
+
'claude-3-opus-20240229',
|
|
615
|
+
'claude-3-sonnet-20240229',
|
|
616
|
+
'claude-3-haiku-20240307',
|
|
617
|
+
'claude-2.1',
|
|
618
|
+
'claude-2',
|
|
619
|
+
'claude-1.2',
|
|
620
|
+
'claude-1',
|
|
621
|
+
'claude-1-100k',
|
|
622
|
+
'claude-instant-1',
|
|
623
|
+
'claude-instant-1-100k',
|
|
624
|
+
];
|
|
625
|
+
|
|
626
|
+
export const bedrockModels = [
|
|
627
|
+
'anthropic.claude-3-5-sonnet-20241022-v2:0',
|
|
628
|
+
'anthropic.claude-3-5-sonnet-20240620-v1:0',
|
|
629
|
+
'anthropic.claude-3-haiku-20240307-v1:0',
|
|
630
|
+
'anthropic.claude-3-opus-20240229-v1:0',
|
|
631
|
+
'anthropic.claude-3-sonnet-20240229-v1:0',
|
|
632
|
+
'anthropic.claude-v2',
|
|
633
|
+
'anthropic.claude-v2:1',
|
|
634
|
+
'anthropic.claude-instant-v1',
|
|
635
|
+
// 'cohere.command-text-v14', // no conversation history
|
|
636
|
+
// 'cohere.command-light-text-v14', // no conversation history
|
|
637
|
+
'cohere.command-r-v1:0',
|
|
638
|
+
'cohere.command-r-plus-v1:0',
|
|
639
|
+
'meta.llama2-13b-chat-v1',
|
|
640
|
+
'meta.llama2-70b-chat-v1',
|
|
641
|
+
'meta.llama3-8b-instruct-v1:0',
|
|
642
|
+
'meta.llama3-70b-instruct-v1:0',
|
|
643
|
+
'meta.llama3-1-8b-instruct-v1:0',
|
|
644
|
+
'meta.llama3-1-70b-instruct-v1:0',
|
|
645
|
+
'meta.llama3-1-405b-instruct-v1:0',
|
|
646
|
+
'mistral.mistral-7b-instruct-v0:2',
|
|
647
|
+
'mistral.mixtral-8x7b-instruct-v0:1',
|
|
648
|
+
'mistral.mistral-large-2402-v1:0',
|
|
649
|
+
'mistral.mistral-large-2407-v1:0',
|
|
650
|
+
'mistral.mistral-small-2402-v1:0',
|
|
651
|
+
'ai21.jamba-instruct-v1:0',
|
|
652
|
+
// 'ai21.j2-mid-v1', // no streaming
|
|
653
|
+
// 'ai21.j2-ultra-v1', no conversation history
|
|
654
|
+
'amazon.titan-text-lite-v1',
|
|
655
|
+
'amazon.titan-text-express-v1',
|
|
656
|
+
'amazon.titan-text-premier-v1:0',
|
|
657
|
+
];
|
|
658
|
+
|
|
534
659
|
export const defaultModels = {
|
|
535
660
|
[EModelEndpoint.azureAssistants]: sharedOpenAIModels,
|
|
536
|
-
[EModelEndpoint.assistants]: ['
|
|
661
|
+
[EModelEndpoint.assistants]: ['chatgpt-4o-latest', ...sharedOpenAIModels],
|
|
662
|
+
[EModelEndpoint.agents]: sharedOpenAIModels, // TODO: Add agent models (agentsModels)
|
|
537
663
|
[EModelEndpoint.google]: [
|
|
538
664
|
'gemini-pro',
|
|
539
665
|
'gemini-pro-vision',
|
|
@@ -548,27 +674,15 @@ export const defaultModels = {
|
|
|
548
674
|
'code-bison',
|
|
549
675
|
'code-bison-32k',
|
|
550
676
|
],
|
|
551
|
-
[EModelEndpoint.anthropic]:
|
|
552
|
-
'claude-3-5-sonnet-20240620',
|
|
553
|
-
'claude-3-opus-20240229',
|
|
554
|
-
'claude-3-sonnet-20240229',
|
|
555
|
-
'claude-3-haiku-20240307',
|
|
556
|
-
'claude-2.1',
|
|
557
|
-
'claude-2',
|
|
558
|
-
'claude-1.2',
|
|
559
|
-
'claude-1',
|
|
560
|
-
'claude-1-100k',
|
|
561
|
-
'claude-instant-1',
|
|
562
|
-
'claude-instant-1-100k',
|
|
563
|
-
],
|
|
677
|
+
[EModelEndpoint.anthropic]: sharedAnthropicModels,
|
|
564
678
|
[EModelEndpoint.openAI]: [
|
|
565
|
-
'
|
|
566
|
-
'gpt-4o',
|
|
679
|
+
'chatgpt-4o-latest',
|
|
567
680
|
...sharedOpenAIModels,
|
|
568
681
|
'gpt-4-vision-preview',
|
|
569
682
|
'gpt-3.5-turbo-instruct-0914',
|
|
570
683
|
'gpt-3.5-turbo-instruct',
|
|
571
684
|
],
|
|
685
|
+
[EModelEndpoint.bedrock]: bedrockModels,
|
|
572
686
|
};
|
|
573
687
|
|
|
574
688
|
const fitlerAssistantModels = (str: string) => {
|
|
@@ -581,12 +695,14 @@ export const initialModelsConfig: TModelsConfig = {
|
|
|
581
695
|
initial: [],
|
|
582
696
|
[EModelEndpoint.openAI]: openAIModels,
|
|
583
697
|
[EModelEndpoint.assistants]: openAIModels.filter(fitlerAssistantModels),
|
|
698
|
+
[EModelEndpoint.agents]: openAIModels, // TODO: Add agent models (agentsModels)
|
|
584
699
|
[EModelEndpoint.gptPlugins]: openAIModels,
|
|
585
700
|
[EModelEndpoint.azureOpenAI]: openAIModels,
|
|
586
701
|
[EModelEndpoint.bingAI]: ['BingAI', 'Sydney'],
|
|
587
702
|
[EModelEndpoint.chatGPTBrowser]: ['text-davinci-002-render-sha'],
|
|
588
703
|
[EModelEndpoint.google]: defaultModels[EModelEndpoint.google],
|
|
589
704
|
[EModelEndpoint.anthropic]: defaultModels[EModelEndpoint.anthropic],
|
|
705
|
+
[EModelEndpoint.bedrock]: defaultModels[EModelEndpoint.bedrock],
|
|
590
706
|
};
|
|
591
707
|
|
|
592
708
|
export const EndpointURLs: { [key in EModelEndpoint]: string } = {
|
|
@@ -600,6 +716,8 @@ export const EndpointURLs: { [key in EModelEndpoint]: string } = {
|
|
|
600
716
|
[EModelEndpoint.chatGPTBrowser]: `/api/ask/${EModelEndpoint.chatGPTBrowser}`,
|
|
601
717
|
[EModelEndpoint.azureAssistants]: '/api/assistants/v1/chat',
|
|
602
718
|
[EModelEndpoint.assistants]: '/api/assistants/v2/chat',
|
|
719
|
+
[EModelEndpoint.agents]: `/api/${EModelEndpoint.agents}/chat`,
|
|
720
|
+
[EModelEndpoint.bedrock]: `/api/${EModelEndpoint.bedrock}/chat`,
|
|
603
721
|
};
|
|
604
722
|
|
|
605
723
|
export const modularEndpoints = new Set<EModelEndpoint | string>([
|
|
@@ -609,6 +727,8 @@ export const modularEndpoints = new Set<EModelEndpoint | string>([
|
|
|
609
727
|
EModelEndpoint.openAI,
|
|
610
728
|
EModelEndpoint.azureOpenAI,
|
|
611
729
|
EModelEndpoint.custom,
|
|
730
|
+
EModelEndpoint.agents,
|
|
731
|
+
EModelEndpoint.bedrock,
|
|
612
732
|
]);
|
|
613
733
|
|
|
614
734
|
export const supportsBalanceCheck = {
|
|
@@ -617,8 +737,10 @@ export const supportsBalanceCheck = {
|
|
|
617
737
|
[EModelEndpoint.anthropic]: true,
|
|
618
738
|
[EModelEndpoint.gptPlugins]: true,
|
|
619
739
|
[EModelEndpoint.assistants]: true,
|
|
740
|
+
[EModelEndpoint.agents]: true,
|
|
620
741
|
[EModelEndpoint.azureAssistants]: true,
|
|
621
742
|
[EModelEndpoint.azureOpenAI]: true,
|
|
743
|
+
[EModelEndpoint.bedrock]: true,
|
|
622
744
|
};
|
|
623
745
|
|
|
624
746
|
export const visionModels = [
|
|
@@ -634,6 +756,7 @@ export const visionModels = [
|
|
|
634
756
|
];
|
|
635
757
|
export enum VisionModes {
|
|
636
758
|
generative = 'generative',
|
|
759
|
+
agents = 'agents',
|
|
637
760
|
}
|
|
638
761
|
|
|
639
762
|
export function validateVisionModel({
|
|
@@ -831,6 +954,18 @@ export enum ErrorTypes {
|
|
|
831
954
|
* Moderation error
|
|
832
955
|
*/
|
|
833
956
|
MODERATION = 'moderation',
|
|
957
|
+
/**
|
|
958
|
+
* Prompt exceeds max length
|
|
959
|
+
*/
|
|
960
|
+
INPUT_LENGTH = 'INPUT_LENGTH',
|
|
961
|
+
/**
|
|
962
|
+
* Invalid request error, API rejected request
|
|
963
|
+
*/
|
|
964
|
+
INVALID_REQUEST = 'invalid_request_error',
|
|
965
|
+
/**
|
|
966
|
+
* Invalid request error, API rejected request
|
|
967
|
+
*/
|
|
968
|
+
NO_SYSTEM_MESSAGES = 'no_system_messages',
|
|
834
969
|
}
|
|
835
970
|
|
|
836
971
|
/**
|
|
@@ -940,9 +1075,9 @@ export enum TTSProviders {
|
|
|
940
1075
|
/** Enum for app-wide constants */
|
|
941
1076
|
export enum Constants {
|
|
942
1077
|
/** Key for the app's version. */
|
|
943
|
-
VERSION = 'v0.7.
|
|
1078
|
+
VERSION = 'v0.7.5',
|
|
944
1079
|
/** Key for the Custom Config's version (librechat.yaml). */
|
|
945
|
-
CONFIG_VERSION = '1.1.
|
|
1080
|
+
CONFIG_VERSION = '1.1.7',
|
|
946
1081
|
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
|
947
1082
|
NO_PARENT = '00000000-0000-0000-0000-000000000000',
|
|
948
1083
|
/** Standard value for the initial conversationId before a request is sent */
|
|
@@ -959,6 +1094,10 @@ export enum Constants {
|
|
|
959
1094
|
DEFAULT_STREAM_RATE = 1,
|
|
960
1095
|
/** Saved Tag */
|
|
961
1096
|
SAVED_TAG = 'Saved',
|
|
1097
|
+
/** Max number of Conversation starters for Agents/Assistants */
|
|
1098
|
+
MAX_CONVO_STARTERS = 4,
|
|
1099
|
+
/** Global/instance Project Name */
|
|
1100
|
+
GLOBAL_PROJECT_NAME = 'instance',
|
|
962
1101
|
}
|
|
963
1102
|
|
|
964
1103
|
export enum LocalStorageKeys {
|
|
@@ -978,10 +1117,12 @@ export enum LocalStorageKeys {
|
|
|
978
1117
|
FILES_TO_DELETE = 'filesToDelete',
|
|
979
1118
|
/** Prefix key for the last selected assistant ID by index */
|
|
980
1119
|
ASST_ID_PREFIX = 'assistant_id__',
|
|
1120
|
+
/** Prefix key for the last selected agent ID by index */
|
|
1121
|
+
AGENT_ID_PREFIX = 'agent_id__',
|
|
981
1122
|
/** Key for the last selected fork setting */
|
|
982
1123
|
FORK_SETTING = 'forkSetting',
|
|
983
1124
|
/** Key for remembering the last selected option, instead of manually selecting */
|
|
984
|
-
REMEMBER_FORK_OPTION = '
|
|
1125
|
+
REMEMBER_FORK_OPTION = 'rememberDefaultFork',
|
|
985
1126
|
/** Key for remembering the split at target fork option modifier */
|
|
986
1127
|
FORK_SPLIT_AT_TARGET = 'splitAtTarget',
|
|
987
1128
|
/** Key for saving text drafts */
|
|
@@ -990,6 +1131,10 @@ export enum LocalStorageKeys {
|
|
|
990
1131
|
FILES_DRAFT = 'filesDraft_',
|
|
991
1132
|
/** Key for last Selected Prompt Category */
|
|
992
1133
|
LAST_PROMPT_CATEGORY = 'lastPromptCategory',
|
|
1134
|
+
/** Key for rendering User Messages as Markdown */
|
|
1135
|
+
ENABLE_USER_MSG_MARKDOWN = 'enableUserMsgMarkdown',
|
|
1136
|
+
/** Key for displaying analysis tool code input */
|
|
1137
|
+
SHOW_ANALYSIS_CODE = 'showAnalysisCode',
|
|
993
1138
|
}
|
|
994
1139
|
|
|
995
1140
|
export enum ForkOptions {
|
|
@@ -1033,3 +1178,10 @@ export enum SystemCategories {
|
|
|
1033
1178
|
NO_CATEGORY = 'sys__no__category__sys',
|
|
1034
1179
|
SHARED_PROMPTS = 'sys__shared__prompts__sys',
|
|
1035
1180
|
}
|
|
1181
|
+
|
|
1182
|
+
export const providerEndpointMap = {
|
|
1183
|
+
[EModelEndpoint.openAI]: EModelEndpoint.openAI,
|
|
1184
|
+
[EModelEndpoint.bedrock]: EModelEndpoint.bedrock,
|
|
1185
|
+
[EModelEndpoint.azureOpenAI]: EModelEndpoint.openAI,
|
|
1186
|
+
[EModelEndpoint.anthropic]: EModelEndpoint.anthropic,
|
|
1187
|
+
};
|