librechat-data-provider 0.7.3 → 0.7.5
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 +276 -1
- package/specs/openapiSpecs.ts +127 -0
- package/src/actions.ts +108 -25
- package/src/api-endpoints.ts +36 -2
- package/src/artifacts.ts +3104 -0
- package/src/bedrock.ts +147 -0
- package/src/config.ts +185 -23
- package/src/data-service.ts +247 -78
- package/src/file-config.ts +4 -1
- package/src/generate.ts +30 -1
- package/src/index.ts +5 -0
- package/src/keys.ts +11 -0
- package/src/parsers.ts +85 -27
- package/src/react-query/react-query-service.ts +25 -0
- package/src/request.ts +3 -0
- package/src/roles.ts +59 -2
- package/src/schemas.ts +361 -173
- package/src/types/agents.ts +220 -0
- package/src/types/assistants.ts +150 -27
- package/src/types/files.ts +5 -0
- package/src/types/mutations.ts +75 -0
- package/src/types/queries.ts +6 -2
- package/src/types/runs.ts +22 -0
- package/src/types.ts +59 -3
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,7 +11,13 @@ 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',
|
|
20
|
+
'gpt-4o-2024-08-06',
|
|
15
21
|
'gpt-4o-mini',
|
|
16
22
|
'gpt-4o-mini-2024-07-18',
|
|
17
23
|
'gpt-4-turbo-preview',
|
|
@@ -133,6 +139,13 @@ export enum Capabilities {
|
|
|
133
139
|
tools = 'tools',
|
|
134
140
|
}
|
|
135
141
|
|
|
142
|
+
export enum AgentCapabilities {
|
|
143
|
+
execute_code = 'execute_code',
|
|
144
|
+
file_search = 'file_search',
|
|
145
|
+
actions = 'actions',
|
|
146
|
+
tools = 'tools',
|
|
147
|
+
}
|
|
148
|
+
|
|
136
149
|
export const defaultAssistantsVersion = {
|
|
137
150
|
[EModelEndpoint.assistants]: 2,
|
|
138
151
|
[EModelEndpoint.azureAssistants]: 1,
|
|
@@ -140,10 +153,19 @@ export const defaultAssistantsVersion = {
|
|
|
140
153
|
|
|
141
154
|
export const baseEndpointSchema = z.object({
|
|
142
155
|
streamRate: z.number().optional(),
|
|
156
|
+
baseURL: z.string().optional(),
|
|
157
|
+
titlePrompt: z.string().optional(),
|
|
158
|
+
titleModel: z.string().optional(),
|
|
143
159
|
});
|
|
144
160
|
|
|
145
161
|
export type TBaseEndpoint = z.infer<typeof baseEndpointSchema>;
|
|
146
162
|
|
|
163
|
+
export const bedrockEndpointSchema = baseEndpointSchema.merge(
|
|
164
|
+
z.object({
|
|
165
|
+
availableRegions: z.array(z.string()).optional(),
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
|
|
147
169
|
export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
148
170
|
z.object({
|
|
149
171
|
/* assistants specific */
|
|
@@ -167,7 +189,6 @@ export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
|
167
189
|
]),
|
|
168
190
|
/* general */
|
|
169
191
|
apiKey: z.string().optional(),
|
|
170
|
-
baseURL: z.string().optional(),
|
|
171
192
|
models: z
|
|
172
193
|
.object({
|
|
173
194
|
default: z.array(z.string()).min(1),
|
|
@@ -177,13 +198,50 @@ export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
|
177
198
|
.optional(),
|
|
178
199
|
titleConvo: z.boolean().optional(),
|
|
179
200
|
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
180
|
-
titleModel: z.string().optional(),
|
|
181
201
|
headers: z.record(z.any()).optional(),
|
|
182
202
|
}),
|
|
183
203
|
);
|
|
184
204
|
|
|
185
205
|
export type TAssistantEndpoint = z.infer<typeof assistantEndpointSchema>;
|
|
186
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
|
+
|
|
187
245
|
export const endpointSchema = baseEndpointSchema.merge(
|
|
188
246
|
z.object({
|
|
189
247
|
name: z.string().refine((value) => !eModelEndpointSchema.safeParse(value).success, {
|
|
@@ -200,7 +258,6 @@ export const endpointSchema = baseEndpointSchema.merge(
|
|
|
200
258
|
}),
|
|
201
259
|
titleConvo: z.boolean().optional(),
|
|
202
260
|
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
203
|
-
titleModel: z.string().optional(),
|
|
204
261
|
summarize: z.boolean().optional(),
|
|
205
262
|
summaryModel: z.string().optional(),
|
|
206
263
|
forcePrompt: z.boolean().optional(),
|
|
@@ -282,7 +339,7 @@ const ttsLocalaiSchema = z.object({
|
|
|
282
339
|
const ttsSchema = z.object({
|
|
283
340
|
openai: ttsOpenaiSchema.optional(),
|
|
284
341
|
azureOpenAI: ttsAzureOpenAISchema.optional(),
|
|
285
|
-
|
|
342
|
+
elevenlabs: ttsElevenLabsSchema.optional(),
|
|
286
343
|
localai: ttsLocalaiSchema.optional(),
|
|
287
344
|
});
|
|
288
345
|
|
|
@@ -405,13 +462,19 @@ export const configSchema = z.object({
|
|
|
405
462
|
.object({
|
|
406
463
|
externalUrl: z.string().optional(),
|
|
407
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(),
|
|
408
468
|
})
|
|
409
469
|
.optional(),
|
|
410
470
|
endpointsMenu: z.boolean().optional(),
|
|
411
471
|
modelSelect: z.boolean().optional(),
|
|
412
472
|
parameters: z.boolean().optional(),
|
|
413
473
|
sidePanel: z.boolean().optional(),
|
|
474
|
+
multiConvo: z.boolean().optional(),
|
|
475
|
+
bookmarks: z.boolean().optional(),
|
|
414
476
|
presets: z.boolean().optional(),
|
|
477
|
+
prompts: z.boolean().optional(),
|
|
415
478
|
})
|
|
416
479
|
.default({
|
|
417
480
|
endpointsMenu: true,
|
|
@@ -419,6 +482,9 @@ export const configSchema = z.object({
|
|
|
419
482
|
parameters: true,
|
|
420
483
|
sidePanel: true,
|
|
421
484
|
presets: true,
|
|
485
|
+
multiConvo: true,
|
|
486
|
+
bookmarks: true,
|
|
487
|
+
prompts: true,
|
|
422
488
|
}),
|
|
423
489
|
fileStrategy: fileSourceSchema.default(FileSources.local),
|
|
424
490
|
registration: z
|
|
@@ -447,7 +513,9 @@ export const configSchema = z.object({
|
|
|
447
513
|
[EModelEndpoint.azureOpenAI]: azureEndpointSchema.optional(),
|
|
448
514
|
[EModelEndpoint.azureAssistants]: assistantEndpointSchema.optional(),
|
|
449
515
|
[EModelEndpoint.assistants]: assistantEndpointSchema.optional(),
|
|
516
|
+
[EModelEndpoint.agents]: agentsEndpointSChema.optional(),
|
|
450
517
|
[EModelEndpoint.custom]: z.array(endpointSchema.partial()).optional(),
|
|
518
|
+
[EModelEndpoint.bedrock]: baseEndpointSchema.optional(),
|
|
451
519
|
})
|
|
452
520
|
.strict()
|
|
453
521
|
.refine((data) => Object.keys(data).length > 0, {
|
|
@@ -471,6 +539,7 @@ export enum KnownEndpoints {
|
|
|
471
539
|
apipie = 'apipie',
|
|
472
540
|
cohere = 'cohere',
|
|
473
541
|
fireworks = 'fireworks',
|
|
542
|
+
deepseek = 'deepseek',
|
|
474
543
|
groq = 'groq',
|
|
475
544
|
huggingface = 'huggingface',
|
|
476
545
|
mistral = 'mistral',
|
|
@@ -480,6 +549,7 @@ export enum KnownEndpoints {
|
|
|
480
549
|
perplexity = 'perplexity',
|
|
481
550
|
shuttleai = 'shuttleai',
|
|
482
551
|
'together.ai' = 'together.ai',
|
|
552
|
+
unify = 'unify',
|
|
483
553
|
}
|
|
484
554
|
|
|
485
555
|
export enum FetchTokenConfig {
|
|
@@ -491,17 +561,20 @@ export const defaultEndpoints: EModelEndpoint[] = [
|
|
|
491
561
|
EModelEndpoint.assistants,
|
|
492
562
|
EModelEndpoint.azureAssistants,
|
|
493
563
|
EModelEndpoint.azureOpenAI,
|
|
564
|
+
EModelEndpoint.agents,
|
|
494
565
|
EModelEndpoint.bingAI,
|
|
495
566
|
EModelEndpoint.chatGPTBrowser,
|
|
496
567
|
EModelEndpoint.gptPlugins,
|
|
497
568
|
EModelEndpoint.google,
|
|
498
569
|
EModelEndpoint.anthropic,
|
|
499
570
|
EModelEndpoint.custom,
|
|
571
|
+
EModelEndpoint.bedrock,
|
|
500
572
|
];
|
|
501
573
|
|
|
502
574
|
export const alternateName = {
|
|
503
575
|
[EModelEndpoint.openAI]: 'OpenAI',
|
|
504
576
|
[EModelEndpoint.assistants]: 'Assistants',
|
|
577
|
+
[EModelEndpoint.agents]: 'Agents',
|
|
505
578
|
[EModelEndpoint.azureAssistants]: 'Azure Assistants',
|
|
506
579
|
[EModelEndpoint.azureOpenAI]: 'Azure OpenAI',
|
|
507
580
|
[EModelEndpoint.bingAI]: 'Bing',
|
|
@@ -510,9 +583,12 @@ export const alternateName = {
|
|
|
510
583
|
[EModelEndpoint.google]: 'Google',
|
|
511
584
|
[EModelEndpoint.anthropic]: 'Anthropic',
|
|
512
585
|
[EModelEndpoint.custom]: 'Custom',
|
|
586
|
+
[EModelEndpoint.bedrock]: 'AWS Bedrock',
|
|
513
587
|
};
|
|
514
588
|
|
|
515
589
|
const sharedOpenAIModels = [
|
|
590
|
+
'gpt-4o-mini',
|
|
591
|
+
'gpt-4o',
|
|
516
592
|
'gpt-3.5-turbo',
|
|
517
593
|
'gpt-3.5-turbo-0125',
|
|
518
594
|
'gpt-4-turbo',
|
|
@@ -530,9 +606,58 @@ const sharedOpenAIModels = [
|
|
|
530
606
|
'gpt-3.5-turbo-0613',
|
|
531
607
|
];
|
|
532
608
|
|
|
609
|
+
const sharedAnthropicModels = [
|
|
610
|
+
'claude-3-5-sonnet-20241022',
|
|
611
|
+
'claude-3-5-sonnet-20240620',
|
|
612
|
+
'claude-3-5-sonnet-latest',
|
|
613
|
+
'claude-3-opus-20240229',
|
|
614
|
+
'claude-3-sonnet-20240229',
|
|
615
|
+
'claude-3-haiku-20240307',
|
|
616
|
+
'claude-2.1',
|
|
617
|
+
'claude-2',
|
|
618
|
+
'claude-1.2',
|
|
619
|
+
'claude-1',
|
|
620
|
+
'claude-1-100k',
|
|
621
|
+
'claude-instant-1',
|
|
622
|
+
'claude-instant-1-100k',
|
|
623
|
+
];
|
|
624
|
+
|
|
625
|
+
export const bedrockModels = [
|
|
626
|
+
'anthropic.claude-3-5-sonnet-20240620-v1:0',
|
|
627
|
+
'anthropic.claude-3-haiku-20240307-v1:0',
|
|
628
|
+
'anthropic.claude-3-opus-20240229-v1:0',
|
|
629
|
+
'anthropic.claude-3-sonnet-20240229-v1:0',
|
|
630
|
+
'anthropic.claude-v2',
|
|
631
|
+
'anthropic.claude-v2:1',
|
|
632
|
+
'anthropic.claude-instant-v1',
|
|
633
|
+
// 'cohere.command-text-v14', // no conversation history
|
|
634
|
+
// 'cohere.command-light-text-v14', // no conversation history
|
|
635
|
+
'cohere.command-r-v1:0',
|
|
636
|
+
'cohere.command-r-plus-v1:0',
|
|
637
|
+
'meta.llama2-13b-chat-v1',
|
|
638
|
+
'meta.llama2-70b-chat-v1',
|
|
639
|
+
'meta.llama3-8b-instruct-v1:0',
|
|
640
|
+
'meta.llama3-70b-instruct-v1:0',
|
|
641
|
+
'meta.llama3-1-8b-instruct-v1:0',
|
|
642
|
+
'meta.llama3-1-70b-instruct-v1:0',
|
|
643
|
+
'meta.llama3-1-405b-instruct-v1:0',
|
|
644
|
+
'mistral.mistral-7b-instruct-v0:2',
|
|
645
|
+
'mistral.mixtral-8x7b-instruct-v0:1',
|
|
646
|
+
'mistral.mistral-large-2402-v1:0',
|
|
647
|
+
'mistral.mistral-large-2407-v1:0',
|
|
648
|
+
'mistral.mistral-small-2402-v1:0',
|
|
649
|
+
'ai21.jamba-instruct-v1:0',
|
|
650
|
+
// 'ai21.j2-mid-v1', // no streaming
|
|
651
|
+
// 'ai21.j2-ultra-v1', no conversation history
|
|
652
|
+
'amazon.titan-text-lite-v1',
|
|
653
|
+
'amazon.titan-text-express-v1',
|
|
654
|
+
'amazon.titan-text-premier-v1:0',
|
|
655
|
+
];
|
|
656
|
+
|
|
533
657
|
export const defaultModels = {
|
|
534
658
|
[EModelEndpoint.azureAssistants]: sharedOpenAIModels,
|
|
535
|
-
[EModelEndpoint.assistants]: ['
|
|
659
|
+
[EModelEndpoint.assistants]: ['chatgpt-4o-latest', ...sharedOpenAIModels],
|
|
660
|
+
[EModelEndpoint.agents]: sharedOpenAIModels, // TODO: Add agent models (agentsModels)
|
|
536
661
|
[EModelEndpoint.google]: [
|
|
537
662
|
'gemini-pro',
|
|
538
663
|
'gemini-pro-vision',
|
|
@@ -547,27 +672,15 @@ export const defaultModels = {
|
|
|
547
672
|
'code-bison',
|
|
548
673
|
'code-bison-32k',
|
|
549
674
|
],
|
|
550
|
-
[EModelEndpoint.anthropic]:
|
|
551
|
-
'claude-3-5-sonnet-20240620',
|
|
552
|
-
'claude-3-opus-20240229',
|
|
553
|
-
'claude-3-sonnet-20240229',
|
|
554
|
-
'claude-3-haiku-20240307',
|
|
555
|
-
'claude-2.1',
|
|
556
|
-
'claude-2',
|
|
557
|
-
'claude-1.2',
|
|
558
|
-
'claude-1',
|
|
559
|
-
'claude-1-100k',
|
|
560
|
-
'claude-instant-1',
|
|
561
|
-
'claude-instant-1-100k',
|
|
562
|
-
],
|
|
675
|
+
[EModelEndpoint.anthropic]: sharedAnthropicModels,
|
|
563
676
|
[EModelEndpoint.openAI]: [
|
|
564
|
-
'
|
|
565
|
-
'gpt-4o',
|
|
677
|
+
'chatgpt-4o-latest',
|
|
566
678
|
...sharedOpenAIModels,
|
|
567
679
|
'gpt-4-vision-preview',
|
|
568
680
|
'gpt-3.5-turbo-instruct-0914',
|
|
569
681
|
'gpt-3.5-turbo-instruct',
|
|
570
682
|
],
|
|
683
|
+
[EModelEndpoint.bedrock]: bedrockModels,
|
|
571
684
|
};
|
|
572
685
|
|
|
573
686
|
const fitlerAssistantModels = (str: string) => {
|
|
@@ -580,12 +693,14 @@ export const initialModelsConfig: TModelsConfig = {
|
|
|
580
693
|
initial: [],
|
|
581
694
|
[EModelEndpoint.openAI]: openAIModels,
|
|
582
695
|
[EModelEndpoint.assistants]: openAIModels.filter(fitlerAssistantModels),
|
|
696
|
+
[EModelEndpoint.agents]: openAIModels, // TODO: Add agent models (agentsModels)
|
|
583
697
|
[EModelEndpoint.gptPlugins]: openAIModels,
|
|
584
698
|
[EModelEndpoint.azureOpenAI]: openAIModels,
|
|
585
699
|
[EModelEndpoint.bingAI]: ['BingAI', 'Sydney'],
|
|
586
700
|
[EModelEndpoint.chatGPTBrowser]: ['text-davinci-002-render-sha'],
|
|
587
701
|
[EModelEndpoint.google]: defaultModels[EModelEndpoint.google],
|
|
588
702
|
[EModelEndpoint.anthropic]: defaultModels[EModelEndpoint.anthropic],
|
|
703
|
+
[EModelEndpoint.bedrock]: defaultModels[EModelEndpoint.bedrock],
|
|
589
704
|
};
|
|
590
705
|
|
|
591
706
|
export const EndpointURLs: { [key in EModelEndpoint]: string } = {
|
|
@@ -599,6 +714,8 @@ export const EndpointURLs: { [key in EModelEndpoint]: string } = {
|
|
|
599
714
|
[EModelEndpoint.chatGPTBrowser]: `/api/ask/${EModelEndpoint.chatGPTBrowser}`,
|
|
600
715
|
[EModelEndpoint.azureAssistants]: '/api/assistants/v1/chat',
|
|
601
716
|
[EModelEndpoint.assistants]: '/api/assistants/v2/chat',
|
|
717
|
+
[EModelEndpoint.agents]: `/api/${EModelEndpoint.agents}/chat`,
|
|
718
|
+
[EModelEndpoint.bedrock]: `/api/${EModelEndpoint.bedrock}/chat`,
|
|
602
719
|
};
|
|
603
720
|
|
|
604
721
|
export const modularEndpoints = new Set<EModelEndpoint | string>([
|
|
@@ -608,6 +725,8 @@ export const modularEndpoints = new Set<EModelEndpoint | string>([
|
|
|
608
725
|
EModelEndpoint.openAI,
|
|
609
726
|
EModelEndpoint.azureOpenAI,
|
|
610
727
|
EModelEndpoint.custom,
|
|
728
|
+
EModelEndpoint.agents,
|
|
729
|
+
EModelEndpoint.bedrock,
|
|
611
730
|
]);
|
|
612
731
|
|
|
613
732
|
export const supportsBalanceCheck = {
|
|
@@ -616,8 +735,10 @@ export const supportsBalanceCheck = {
|
|
|
616
735
|
[EModelEndpoint.anthropic]: true,
|
|
617
736
|
[EModelEndpoint.gptPlugins]: true,
|
|
618
737
|
[EModelEndpoint.assistants]: true,
|
|
738
|
+
[EModelEndpoint.agents]: true,
|
|
619
739
|
[EModelEndpoint.azureAssistants]: true,
|
|
620
740
|
[EModelEndpoint.azureOpenAI]: true,
|
|
741
|
+
[EModelEndpoint.bedrock]: true,
|
|
621
742
|
};
|
|
622
743
|
|
|
623
744
|
export const visionModels = [
|
|
@@ -633,6 +754,7 @@ export const visionModels = [
|
|
|
633
754
|
];
|
|
634
755
|
export enum VisionModes {
|
|
635
756
|
generative = 'generative',
|
|
757
|
+
agents = 'agents',
|
|
636
758
|
}
|
|
637
759
|
|
|
638
760
|
export function validateVisionModel({
|
|
@@ -679,6 +801,7 @@ export enum InfiniteCollections {
|
|
|
679
801
|
* Enum for time intervals
|
|
680
802
|
*/
|
|
681
803
|
export enum Time {
|
|
804
|
+
ONE_HOUR = 3600000,
|
|
682
805
|
THIRTY_MINUTES = 1800000,
|
|
683
806
|
TEN_MINUTES = 600000,
|
|
684
807
|
FIVE_MINUTES = 300000,
|
|
@@ -799,6 +922,10 @@ export enum ViolationTypes {
|
|
|
799
922
|
* Verify Email Limit Violation.
|
|
800
923
|
*/
|
|
801
924
|
VERIFY_EMAIL_LIMIT = 'verify_email_limit',
|
|
925
|
+
/**
|
|
926
|
+
* Verify Conversation Access violation.
|
|
927
|
+
*/
|
|
928
|
+
CONVO_ACCESS = 'convo_access',
|
|
802
929
|
}
|
|
803
930
|
|
|
804
931
|
/**
|
|
@@ -825,6 +952,18 @@ export enum ErrorTypes {
|
|
|
825
952
|
* Moderation error
|
|
826
953
|
*/
|
|
827
954
|
MODERATION = 'moderation',
|
|
955
|
+
/**
|
|
956
|
+
* Prompt exceeds max length
|
|
957
|
+
*/
|
|
958
|
+
INPUT_LENGTH = 'INPUT_LENGTH',
|
|
959
|
+
/**
|
|
960
|
+
* Invalid request error, API rejected request
|
|
961
|
+
*/
|
|
962
|
+
INVALID_REQUEST = 'invalid_request_error',
|
|
963
|
+
/**
|
|
964
|
+
* Invalid request error, API rejected request
|
|
965
|
+
*/
|
|
966
|
+
NO_SYSTEM_MESSAGES = 'no_system_messages',
|
|
828
967
|
}
|
|
829
968
|
|
|
830
969
|
/**
|
|
@@ -895,6 +1034,10 @@ export enum SettingsTabValues {
|
|
|
895
1034
|
* Tab for Account Settings
|
|
896
1035
|
*/
|
|
897
1036
|
ACCOUNT = 'account',
|
|
1037
|
+
/**
|
|
1038
|
+
* Chat input commands
|
|
1039
|
+
*/
|
|
1040
|
+
COMMANDS = 'commands',
|
|
898
1041
|
}
|
|
899
1042
|
|
|
900
1043
|
export enum STTProviders {
|
|
@@ -930,9 +1073,9 @@ export enum TTSProviders {
|
|
|
930
1073
|
/** Enum for app-wide constants */
|
|
931
1074
|
export enum Constants {
|
|
932
1075
|
/** Key for the app's version. */
|
|
933
|
-
VERSION = 'v0.7.
|
|
1076
|
+
VERSION = 'v0.7.5',
|
|
934
1077
|
/** Key for the Custom Config's version (librechat.yaml). */
|
|
935
|
-
CONFIG_VERSION = '1.1.
|
|
1078
|
+
CONFIG_VERSION = '1.1.7',
|
|
936
1079
|
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
|
937
1080
|
NO_PARENT = '00000000-0000-0000-0000-000000000000',
|
|
938
1081
|
/** Standard value for the initial conversationId before a request is sent */
|
|
@@ -947,6 +1090,12 @@ export enum Constants {
|
|
|
947
1090
|
COMMANDS_MAX_LENGTH = 56,
|
|
948
1091
|
/** Default Stream Rate (ms) */
|
|
949
1092
|
DEFAULT_STREAM_RATE = 1,
|
|
1093
|
+
/** Saved Tag */
|
|
1094
|
+
SAVED_TAG = 'Saved',
|
|
1095
|
+
/** Max number of Conversation starters for Agents/Assistants */
|
|
1096
|
+
MAX_CONVO_STARTERS = 4,
|
|
1097
|
+
/** Global/instance Project Name */
|
|
1098
|
+
GLOBAL_PROJECT_NAME = 'instance',
|
|
950
1099
|
}
|
|
951
1100
|
|
|
952
1101
|
export enum LocalStorageKeys {
|
|
@@ -966,10 +1115,12 @@ export enum LocalStorageKeys {
|
|
|
966
1115
|
FILES_TO_DELETE = 'filesToDelete',
|
|
967
1116
|
/** Prefix key for the last selected assistant ID by index */
|
|
968
1117
|
ASST_ID_PREFIX = 'assistant_id__',
|
|
1118
|
+
/** Prefix key for the last selected agent ID by index */
|
|
1119
|
+
AGENT_ID_PREFIX = 'agent_id__',
|
|
969
1120
|
/** Key for the last selected fork setting */
|
|
970
1121
|
FORK_SETTING = 'forkSetting',
|
|
971
1122
|
/** Key for remembering the last selected option, instead of manually selecting */
|
|
972
|
-
REMEMBER_FORK_OPTION = '
|
|
1123
|
+
REMEMBER_FORK_OPTION = 'rememberDefaultFork',
|
|
973
1124
|
/** Key for remembering the split at target fork option modifier */
|
|
974
1125
|
FORK_SPLIT_AT_TARGET = 'splitAtTarget',
|
|
975
1126
|
/** Key for saving text drafts */
|
|
@@ -978,6 +1129,10 @@ export enum LocalStorageKeys {
|
|
|
978
1129
|
FILES_DRAFT = 'filesDraft_',
|
|
979
1130
|
/** Key for last Selected Prompt Category */
|
|
980
1131
|
LAST_PROMPT_CATEGORY = 'lastPromptCategory',
|
|
1132
|
+
/** Key for rendering User Messages as Markdown */
|
|
1133
|
+
ENABLE_USER_MSG_MARKDOWN = 'enableUserMsgMarkdown',
|
|
1134
|
+
/** Key for displaying analysis tool code input */
|
|
1135
|
+
SHOW_ANALYSIS_CODE = 'showAnalysisCode',
|
|
981
1136
|
}
|
|
982
1137
|
|
|
983
1138
|
export enum ForkOptions {
|
|
@@ -1021,3 +1176,10 @@ export enum SystemCategories {
|
|
|
1021
1176
|
NO_CATEGORY = 'sys__no__category__sys',
|
|
1022
1177
|
SHARED_PROMPTS = 'sys__shared__prompts__sys',
|
|
1023
1178
|
}
|
|
1179
|
+
|
|
1180
|
+
export const providerEndpointMap = {
|
|
1181
|
+
[EModelEndpoint.openAI]: EModelEndpoint.openAI,
|
|
1182
|
+
[EModelEndpoint.bedrock]: EModelEndpoint.bedrock,
|
|
1183
|
+
[EModelEndpoint.azureOpenAI]: EModelEndpoint.openAI,
|
|
1184
|
+
[EModelEndpoint.anthropic]: EModelEndpoint.anthropic,
|
|
1185
|
+
};
|