librechat-data-provider 0.7.69 → 0.7.72
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 +2 -2
- package/server-rollup.config.js +1 -1
- package/specs/actions.spec.ts +125 -7
- package/specs/filetypes.spec.ts +1 -7
- package/specs/mcp.spec.ts +52 -0
- package/specs/utils.spec.ts +129 -0
- package/src/actions.ts +100 -44
- package/src/api-endpoints.ts +23 -5
- package/src/azure.ts +2 -1
- package/src/bedrock.ts +84 -4
- package/src/config.ts +178 -74
- package/src/createPayload.ts +3 -1
- package/src/data-service.ts +54 -15
- package/src/file-config.ts +7 -0
- package/src/generate.ts +1 -1
- package/src/index.ts +2 -0
- package/src/keys.ts +4 -0
- package/src/mcp.ts +17 -1
- package/src/models.ts +1 -1
- package/src/ocr.ts +14 -0
- package/src/parsers.ts +43 -43
- package/src/react-query/react-query-service.ts +33 -119
- package/src/request.ts +7 -0
- package/src/roles.ts +33 -1
- package/src/schemas.ts +165 -184
- package/src/types/agents.ts +56 -7
- package/src/types/assistants.ts +28 -4
- package/src/types/files.ts +2 -0
- package/src/types/mutations.ts +41 -3
- package/src/types/queries.ts +24 -13
- package/src/types/runs.ts +2 -0
- package/src/types.ts +78 -77
- package/src/utils.ts +44 -0
- package/src/zod.spec.ts +86 -27
- package/src/zod.ts +22 -2
- package/tsconfig.json +1 -2
- package/specs/parsers.spec.ts +0 -48
package/src/schemas.ts
CHANGED
|
@@ -24,8 +24,6 @@ export enum EModelEndpoint {
|
|
|
24
24
|
custom = 'custom',
|
|
25
25
|
bedrock = 'bedrock',
|
|
26
26
|
/** @deprecated */
|
|
27
|
-
bingAI = 'bingAI',
|
|
28
|
-
/** @deprecated */
|
|
29
27
|
chatGPTBrowser = 'chatGPTBrowser',
|
|
30
28
|
/** @deprecated */
|
|
31
29
|
gptPlugins = 'gptPlugins',
|
|
@@ -38,6 +36,7 @@ export const paramEndpoints = new Set<EModelEndpoint | string>([
|
|
|
38
36
|
EModelEndpoint.azureOpenAI,
|
|
39
37
|
EModelEndpoint.anthropic,
|
|
40
38
|
EModelEndpoint.custom,
|
|
39
|
+
EModelEndpoint.google,
|
|
41
40
|
]);
|
|
42
41
|
|
|
43
42
|
export enum BedrockProviders {
|
|
@@ -48,6 +47,7 @@ export enum BedrockProviders {
|
|
|
48
47
|
Meta = 'meta',
|
|
49
48
|
MistralAI = 'mistral',
|
|
50
49
|
StabilityAI = 'stability',
|
|
50
|
+
DeepSeek = 'deepseek',
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export const getModelKey = (endpoint: EModelEndpoint | string, model: string) => {
|
|
@@ -109,6 +109,12 @@ export enum ImageDetail {
|
|
|
109
109
|
high = 'high',
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
export enum ReasoningEffort {
|
|
113
|
+
low = 'low',
|
|
114
|
+
medium = 'medium',
|
|
115
|
+
high = 'high',
|
|
116
|
+
}
|
|
117
|
+
|
|
112
118
|
export const imageDetailNumeric = {
|
|
113
119
|
[ImageDetail.low]: 0,
|
|
114
120
|
[ImageDetail.auto]: 1,
|
|
@@ -122,6 +128,7 @@ export const imageDetailValue = {
|
|
|
122
128
|
};
|
|
123
129
|
|
|
124
130
|
export const eImageDetailSchema = z.nativeEnum(ImageDetail);
|
|
131
|
+
export const eReasoningEffortSchema = z.nativeEnum(ReasoningEffort);
|
|
125
132
|
|
|
126
133
|
export const defaultAssistantFormValues = {
|
|
127
134
|
assistant: '',
|
|
@@ -149,7 +156,9 @@ export const defaultAgentFormValues = {
|
|
|
149
156
|
tools: [],
|
|
150
157
|
provider: {},
|
|
151
158
|
projectIds: [],
|
|
159
|
+
artifacts: '',
|
|
152
160
|
isCollaborative: false,
|
|
161
|
+
recursion_limit: undefined,
|
|
153
162
|
[Tools.execute_code]: false,
|
|
154
163
|
[Tools.file_search]: false,
|
|
155
164
|
};
|
|
@@ -172,34 +181,34 @@ export const isImageVisionTool = (tool: FunctionTool | FunctionToolCall) =>
|
|
|
172
181
|
|
|
173
182
|
export const openAISettings = {
|
|
174
183
|
model: {
|
|
175
|
-
default: 'gpt-4o',
|
|
184
|
+
default: 'gpt-4o-mini' as const,
|
|
176
185
|
},
|
|
177
186
|
temperature: {
|
|
178
|
-
min: 0,
|
|
179
|
-
max: 2,
|
|
180
|
-
step: 0.01,
|
|
181
|
-
default: 1,
|
|
187
|
+
min: 0 as const,
|
|
188
|
+
max: 2 as const,
|
|
189
|
+
step: 0.01 as const,
|
|
190
|
+
default: 1 as const,
|
|
182
191
|
},
|
|
183
192
|
top_p: {
|
|
184
|
-
min: 0,
|
|
185
|
-
max: 1,
|
|
186
|
-
step: 0.01,
|
|
187
|
-
default: 1,
|
|
193
|
+
min: 0 as const,
|
|
194
|
+
max: 1 as const,
|
|
195
|
+
step: 0.01 as const,
|
|
196
|
+
default: 1 as const,
|
|
188
197
|
},
|
|
189
198
|
presence_penalty: {
|
|
190
|
-
min: 0,
|
|
191
|
-
max: 2,
|
|
192
|
-
step: 0.01,
|
|
193
|
-
default: 0,
|
|
199
|
+
min: 0 as const,
|
|
200
|
+
max: 2 as const,
|
|
201
|
+
step: 0.01 as const,
|
|
202
|
+
default: 0 as const,
|
|
194
203
|
},
|
|
195
204
|
frequency_penalty: {
|
|
196
|
-
min: 0,
|
|
197
|
-
max: 2,
|
|
198
|
-
step: 0.01,
|
|
199
|
-
default: 0,
|
|
205
|
+
min: 0 as const,
|
|
206
|
+
max: 2 as const,
|
|
207
|
+
step: 0.01 as const,
|
|
208
|
+
default: 0 as const,
|
|
200
209
|
},
|
|
201
210
|
resendFiles: {
|
|
202
|
-
default: true,
|
|
211
|
+
default: true as const,
|
|
203
212
|
},
|
|
204
213
|
maxContextTokens: {
|
|
205
214
|
default: undefined,
|
|
@@ -208,72 +217,85 @@ export const openAISettings = {
|
|
|
208
217
|
default: undefined,
|
|
209
218
|
},
|
|
210
219
|
imageDetail: {
|
|
211
|
-
default: ImageDetail.auto,
|
|
212
|
-
min: 0,
|
|
213
|
-
max: 2,
|
|
214
|
-
step: 1,
|
|
220
|
+
default: ImageDetail.auto as const,
|
|
221
|
+
min: 0 as const,
|
|
222
|
+
max: 2 as const,
|
|
223
|
+
step: 1 as const,
|
|
215
224
|
},
|
|
216
225
|
};
|
|
217
226
|
|
|
218
227
|
export const googleSettings = {
|
|
219
228
|
model: {
|
|
220
|
-
default: 'gemini-1.5-flash-latest',
|
|
229
|
+
default: 'gemini-1.5-flash-latest' as const,
|
|
221
230
|
},
|
|
222
231
|
maxOutputTokens: {
|
|
223
|
-
min: 1,
|
|
224
|
-
max: 8192,
|
|
225
|
-
step: 1,
|
|
226
|
-
default: 8192,
|
|
232
|
+
min: 1 as const,
|
|
233
|
+
max: 8192 as const,
|
|
234
|
+
step: 1 as const,
|
|
235
|
+
default: 8192 as const,
|
|
227
236
|
},
|
|
228
237
|
temperature: {
|
|
229
|
-
min: 0,
|
|
230
|
-
max: 2,
|
|
231
|
-
step: 0.01,
|
|
232
|
-
default: 1,
|
|
238
|
+
min: 0 as const,
|
|
239
|
+
max: 2 as const,
|
|
240
|
+
step: 0.01 as const,
|
|
241
|
+
default: 1 as const,
|
|
233
242
|
},
|
|
234
243
|
topP: {
|
|
235
|
-
min: 0,
|
|
236
|
-
max: 1,
|
|
237
|
-
step: 0.01,
|
|
238
|
-
default: 0.95,
|
|
244
|
+
min: 0 as const,
|
|
245
|
+
max: 1 as const,
|
|
246
|
+
step: 0.01 as const,
|
|
247
|
+
default: 0.95 as const,
|
|
239
248
|
},
|
|
240
249
|
topK: {
|
|
241
|
-
min: 1,
|
|
242
|
-
max: 40,
|
|
243
|
-
step: 1,
|
|
244
|
-
default: 40,
|
|
250
|
+
min: 1 as const,
|
|
251
|
+
max: 40 as const,
|
|
252
|
+
step: 1 as const,
|
|
253
|
+
default: 40 as const,
|
|
245
254
|
},
|
|
246
255
|
};
|
|
247
256
|
|
|
248
|
-
const ANTHROPIC_MAX_OUTPUT =
|
|
249
|
-
const
|
|
257
|
+
const ANTHROPIC_MAX_OUTPUT = 128000 as const;
|
|
258
|
+
const DEFAULT_MAX_OUTPUT = 8192 as const;
|
|
259
|
+
const LEGACY_ANTHROPIC_MAX_OUTPUT = 4096 as const;
|
|
250
260
|
export const anthropicSettings = {
|
|
251
261
|
model: {
|
|
252
|
-
default: 'claude-3-5-sonnet-
|
|
262
|
+
default: 'claude-3-5-sonnet-latest' as const,
|
|
253
263
|
},
|
|
254
264
|
temperature: {
|
|
255
|
-
min: 0,
|
|
256
|
-
max: 1,
|
|
257
|
-
step: 0.01,
|
|
258
|
-
default: 1,
|
|
265
|
+
min: 0 as const,
|
|
266
|
+
max: 1 as const,
|
|
267
|
+
step: 0.01 as const,
|
|
268
|
+
default: 1 as const,
|
|
259
269
|
},
|
|
260
270
|
promptCache: {
|
|
261
|
-
default: true,
|
|
271
|
+
default: true as const,
|
|
272
|
+
},
|
|
273
|
+
thinking: {
|
|
274
|
+
default: true as const,
|
|
275
|
+
},
|
|
276
|
+
thinkingBudget: {
|
|
277
|
+
min: 1024 as const,
|
|
278
|
+
step: 100 as const,
|
|
279
|
+
max: 200000 as const,
|
|
280
|
+
default: 2000 as const,
|
|
262
281
|
},
|
|
263
282
|
maxOutputTokens: {
|
|
264
|
-
min: 1,
|
|
283
|
+
min: 1 as const,
|
|
265
284
|
max: ANTHROPIC_MAX_OUTPUT,
|
|
266
|
-
step: 1,
|
|
267
|
-
default:
|
|
285
|
+
step: 1 as const,
|
|
286
|
+
default: DEFAULT_MAX_OUTPUT,
|
|
268
287
|
reset: (modelName: string) => {
|
|
269
|
-
if (
|
|
270
|
-
return
|
|
288
|
+
if (/claude-3[-.]5-sonnet/.test(modelName) || /claude-3[-.]7/.test(modelName)) {
|
|
289
|
+
return DEFAULT_MAX_OUTPUT;
|
|
271
290
|
}
|
|
272
291
|
|
|
273
292
|
return 4096;
|
|
274
293
|
},
|
|
275
294
|
set: (value: number, modelName: string) => {
|
|
276
|
-
if (
|
|
295
|
+
if (
|
|
296
|
+
!(/claude-3[-.]5-sonnet/.test(modelName) || /claude-3[-.]7/.test(modelName)) &&
|
|
297
|
+
value > LEGACY_ANTHROPIC_MAX_OUTPUT
|
|
298
|
+
) {
|
|
277
299
|
return LEGACY_ANTHROPIC_MAX_OUTPUT;
|
|
278
300
|
}
|
|
279
301
|
|
|
@@ -281,28 +303,28 @@ export const anthropicSettings = {
|
|
|
281
303
|
},
|
|
282
304
|
},
|
|
283
305
|
topP: {
|
|
284
|
-
min: 0,
|
|
285
|
-
max: 1,
|
|
286
|
-
step: 0.01,
|
|
287
|
-
default: 0.7,
|
|
306
|
+
min: 0 as const,
|
|
307
|
+
max: 1 as const,
|
|
308
|
+
step: 0.01 as const,
|
|
309
|
+
default: 0.7 as const,
|
|
288
310
|
},
|
|
289
311
|
topK: {
|
|
290
|
-
min: 1,
|
|
291
|
-
max: 40,
|
|
292
|
-
step: 1,
|
|
293
|
-
default: 5,
|
|
312
|
+
min: 1 as const,
|
|
313
|
+
max: 40 as const,
|
|
314
|
+
step: 1 as const,
|
|
315
|
+
default: 5 as const,
|
|
294
316
|
},
|
|
295
317
|
resendFiles: {
|
|
296
|
-
default: true,
|
|
318
|
+
default: true as const,
|
|
297
319
|
},
|
|
298
320
|
maxContextTokens: {
|
|
299
321
|
default: undefined,
|
|
300
322
|
},
|
|
301
323
|
legacy: {
|
|
302
324
|
maxOutputTokens: {
|
|
303
|
-
min: 1,
|
|
325
|
+
min: 1 as const,
|
|
304
326
|
max: LEGACY_ANTHROPIC_MAX_OUTPUT,
|
|
305
|
-
step: 1,
|
|
327
|
+
step: 1 as const,
|
|
306
328
|
default: LEGACY_ANTHROPIC_MAX_OUTPUT,
|
|
307
329
|
},
|
|
308
330
|
},
|
|
@@ -310,34 +332,34 @@ export const anthropicSettings = {
|
|
|
310
332
|
|
|
311
333
|
export const agentsSettings = {
|
|
312
334
|
model: {
|
|
313
|
-
default: 'gpt-3.5-turbo-test',
|
|
335
|
+
default: 'gpt-3.5-turbo-test' as const,
|
|
314
336
|
},
|
|
315
337
|
temperature: {
|
|
316
|
-
min: 0,
|
|
317
|
-
max: 1,
|
|
318
|
-
step: 0.01,
|
|
319
|
-
default: 1,
|
|
338
|
+
min: 0 as const,
|
|
339
|
+
max: 1 as const,
|
|
340
|
+
step: 0.01 as const,
|
|
341
|
+
default: 1 as const,
|
|
320
342
|
},
|
|
321
343
|
top_p: {
|
|
322
|
-
min: 0,
|
|
323
|
-
max: 1,
|
|
324
|
-
step: 0.01,
|
|
325
|
-
default: 1,
|
|
344
|
+
min: 0 as const,
|
|
345
|
+
max: 1 as const,
|
|
346
|
+
step: 0.01 as const,
|
|
347
|
+
default: 1 as const,
|
|
326
348
|
},
|
|
327
349
|
presence_penalty: {
|
|
328
|
-
min: 0,
|
|
329
|
-
max: 2,
|
|
330
|
-
step: 0.01,
|
|
331
|
-
default: 0,
|
|
350
|
+
min: 0 as const,
|
|
351
|
+
max: 2 as const,
|
|
352
|
+
step: 0.01 as const,
|
|
353
|
+
default: 0 as const,
|
|
332
354
|
},
|
|
333
355
|
frequency_penalty: {
|
|
334
|
-
min: 0,
|
|
335
|
-
max: 2,
|
|
336
|
-
step: 0.01,
|
|
337
|
-
default: 0,
|
|
356
|
+
min: 0 as const,
|
|
357
|
+
max: 2 as const,
|
|
358
|
+
step: 0.01 as const,
|
|
359
|
+
default: 0 as const,
|
|
338
360
|
},
|
|
339
361
|
resendFiles: {
|
|
340
|
-
default: true,
|
|
362
|
+
default: true as const,
|
|
341
363
|
},
|
|
342
364
|
maxContextTokens: {
|
|
343
365
|
default: undefined,
|
|
@@ -346,7 +368,7 @@ export const agentsSettings = {
|
|
|
346
368
|
default: undefined,
|
|
347
369
|
},
|
|
348
370
|
imageDetail: {
|
|
349
|
-
default: ImageDetail.auto,
|
|
371
|
+
default: ImageDetail.auto as const,
|
|
350
372
|
},
|
|
351
373
|
};
|
|
352
374
|
|
|
@@ -380,6 +402,7 @@ export const tPluginSchema = z.object({
|
|
|
380
402
|
authConfig: z.array(tPluginAuthConfigSchema).optional(),
|
|
381
403
|
authenticated: z.boolean().optional(),
|
|
382
404
|
isButton: z.boolean().optional(),
|
|
405
|
+
toolkit: z.boolean().optional(),
|
|
383
406
|
});
|
|
384
407
|
|
|
385
408
|
export type TPlugin = z.infer<typeof tPluginSchema>;
|
|
@@ -456,7 +479,6 @@ export const tMessageSchema = z.object({
|
|
|
456
479
|
sender: z.string().optional(),
|
|
457
480
|
text: z.string(),
|
|
458
481
|
generation: z.string().nullable().optional(),
|
|
459
|
-
isEdited: z.boolean().optional(),
|
|
460
482
|
isCreatedByUser: z.boolean(),
|
|
461
483
|
error: z.boolean().optional(),
|
|
462
484
|
clientTimestamp: z.string().optional(),
|
|
@@ -475,7 +497,7 @@ export const tMessageSchema = z.object({
|
|
|
475
497
|
/* assistant */
|
|
476
498
|
thread_id: z.string().optional(),
|
|
477
499
|
/* frontend components */
|
|
478
|
-
iconURL: z.string().optional(),
|
|
500
|
+
iconURL: z.string().nullable().optional(),
|
|
479
501
|
});
|
|
480
502
|
|
|
481
503
|
export type TAttachmentMetadata = { messageId: string; toolCallId: string };
|
|
@@ -526,7 +548,7 @@ const DocumentType: z.ZodType<DocumentTypeValue> = z.lazy(() =>
|
|
|
526
548
|
export const tConversationSchema = z.object({
|
|
527
549
|
conversationId: z.string().nullable(),
|
|
528
550
|
endpoint: eModelEndpointSchema.nullable(),
|
|
529
|
-
endpointType: eModelEndpointSchema.optional(),
|
|
551
|
+
endpointType: eModelEndpointSchema.nullable().optional(),
|
|
530
552
|
isArchived: z.boolean().optional(),
|
|
531
553
|
title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),
|
|
532
554
|
user: z.string().optional(),
|
|
@@ -549,6 +571,8 @@ export const tConversationSchema = z.object({
|
|
|
549
571
|
/* Anthropic */
|
|
550
572
|
promptCache: z.boolean().optional(),
|
|
551
573
|
system: z.string().optional(),
|
|
574
|
+
thinking: z.boolean().optional(),
|
|
575
|
+
thinkingBudget: coerceNumber.optional(),
|
|
552
576
|
/* artifacts */
|
|
553
577
|
artifacts: z.string().optional(),
|
|
554
578
|
/* google */
|
|
@@ -559,10 +583,12 @@ export const tConversationSchema = z.object({
|
|
|
559
583
|
createdAt: z.string(),
|
|
560
584
|
updatedAt: z.string(),
|
|
561
585
|
/* Files */
|
|
586
|
+
resendFiles: z.boolean().optional(),
|
|
562
587
|
file_ids: z.array(z.string()).optional(),
|
|
563
588
|
/* vision */
|
|
564
|
-
resendFiles: z.boolean().optional(),
|
|
565
589
|
imageDetail: eImageDetailSchema.optional(),
|
|
590
|
+
/* OpenAI: o1 only */
|
|
591
|
+
reasoning_effort: eReasoningEffortSchema.optional(),
|
|
566
592
|
/* assistant */
|
|
567
593
|
assistant_id: z.string().optional(),
|
|
568
594
|
/* agents */
|
|
@@ -571,42 +597,25 @@ export const tConversationSchema = z.object({
|
|
|
571
597
|
region: z.string().optional(),
|
|
572
598
|
maxTokens: coerceNumber.optional(),
|
|
573
599
|
additionalModelRequestFields: DocumentType.optional(),
|
|
574
|
-
/*
|
|
600
|
+
/* assistants */
|
|
575
601
|
instructions: z.string().optional(),
|
|
576
602
|
additional_instructions: z.string().optional(),
|
|
603
|
+
append_current_datetime: z.boolean().optional(),
|
|
577
604
|
/** Used to overwrite active conversation settings when saving a Preset */
|
|
578
605
|
presetOverride: z.record(z.unknown()).optional(),
|
|
579
606
|
stop: z.array(z.string()).optional(),
|
|
580
607
|
/* frontend components */
|
|
581
|
-
iconURL: z.string().optional(),
|
|
582
608
|
greeting: z.string().optional(),
|
|
583
|
-
spec: z.string().optional(),
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
/** @deprecated */
|
|
588
|
-
suggestions: z.array(z.string()).optional(),
|
|
589
|
-
/** @deprecated */
|
|
590
|
-
systemMessage: z.string().nullable().optional(),
|
|
591
|
-
/** @deprecated */
|
|
592
|
-
jailbreak: z.boolean().optional(),
|
|
593
|
-
/** @deprecated */
|
|
594
|
-
jailbreakConversationId: z.string().nullable().optional(),
|
|
595
|
-
/** @deprecated */
|
|
596
|
-
conversationSignature: z.string().nullable().optional(),
|
|
597
|
-
/** @deprecated */
|
|
598
|
-
clientId: z.string().nullable().optional(),
|
|
599
|
-
/** @deprecated */
|
|
600
|
-
invocationId: z.number().nullable().optional(),
|
|
601
|
-
/** @deprecated */
|
|
602
|
-
toneStyle: z.string().nullable().optional(),
|
|
609
|
+
spec: z.string().nullable().optional(),
|
|
610
|
+
iconURL: z.string().nullable().optional(),
|
|
611
|
+
/* temporary chat */
|
|
612
|
+
expiredAt: z.string().nullable().optional(),
|
|
603
613
|
/** @deprecated */
|
|
604
614
|
resendImages: z.boolean().optional(),
|
|
605
615
|
/** @deprecated */
|
|
606
616
|
agentOptions: tAgentOptionsSchema.nullable().optional(),
|
|
607
617
|
/** @deprecated Prefer `modelLabel` over `chatGptLabel` */
|
|
608
618
|
chatGptLabel: z.string().nullable().optional(),
|
|
609
|
-
append_current_datetime: z.boolean().optional(),
|
|
610
619
|
});
|
|
611
620
|
|
|
612
621
|
export const tPresetSchema = tConversationSchema
|
|
@@ -642,6 +651,13 @@ export const tQueryParamsSchema = tConversationSchema
|
|
|
642
651
|
* Whether or not to re-submit files from previous messages on subsequent messages
|
|
643
652
|
* */
|
|
644
653
|
resendFiles: true,
|
|
654
|
+
/**
|
|
655
|
+
* @endpoints openAI, custom, azureOpenAI
|
|
656
|
+
*
|
|
657
|
+
* System parameter that only affects the above endpoints.
|
|
658
|
+
* Image detail for re-sizing according to OpenAI spec, defaults to `auto`
|
|
659
|
+
* */
|
|
660
|
+
imageDetail: true,
|
|
645
661
|
/**
|
|
646
662
|
* AKA Custom Instructions, dynamically added to chat history as a system message;
|
|
647
663
|
* for `bedrock` endpoint, this is used as the `system` model param if the provider uses it;
|
|
@@ -673,6 +689,8 @@ export const tQueryParamsSchema = tConversationSchema
|
|
|
673
689
|
maxOutputTokens: true,
|
|
674
690
|
/** @endpoints anthropic */
|
|
675
691
|
promptCache: true,
|
|
692
|
+
thinking: true,
|
|
693
|
+
thinkingBudget: true,
|
|
676
694
|
/** @endpoints bedrock */
|
|
677
695
|
region: true,
|
|
678
696
|
/** @endpoints bedrock */
|
|
@@ -681,6 +699,8 @@ export const tQueryParamsSchema = tConversationSchema
|
|
|
681
699
|
agent_id: true,
|
|
682
700
|
/** @endpoints assistants, azureAssistants */
|
|
683
701
|
assistant_id: true,
|
|
702
|
+
/** @endpoints assistants, azureAssistants */
|
|
703
|
+
append_current_datetime: true,
|
|
684
704
|
/**
|
|
685
705
|
* @endpoints assistants, azureAssistants
|
|
686
706
|
*
|
|
@@ -710,13 +730,12 @@ export const tSharedLinkSchema = z.object({
|
|
|
710
730
|
conversationId: z.string(),
|
|
711
731
|
shareId: z.string(),
|
|
712
732
|
messages: z.array(z.string()),
|
|
713
|
-
isAnonymous: z.boolean(),
|
|
714
733
|
isPublic: z.boolean(),
|
|
715
|
-
isVisible: z.boolean(),
|
|
716
734
|
title: z.string(),
|
|
717
735
|
createdAt: z.string(),
|
|
718
736
|
updatedAt: z.string(),
|
|
719
737
|
});
|
|
738
|
+
|
|
720
739
|
export type TSharedLink = z.infer<typeof tSharedLinkSchema>;
|
|
721
740
|
|
|
722
741
|
export const tConversationTagSchema = z.object({
|
|
@@ -747,72 +766,27 @@ export const googleSchema = tConversationSchema
|
|
|
747
766
|
spec: true,
|
|
748
767
|
maxContextTokens: true,
|
|
749
768
|
})
|
|
750
|
-
.transform((obj) =>
|
|
751
|
-
|
|
752
|
-
...obj,
|
|
753
|
-
model: obj.model ?? google.model.default,
|
|
754
|
-
modelLabel: obj.modelLabel ?? null,
|
|
755
|
-
promptPrefix: obj.promptPrefix ?? null,
|
|
756
|
-
examples: obj.examples ?? [{ input: { content: '' }, output: { content: '' } }],
|
|
757
|
-
temperature: obj.temperature ?? google.temperature.default,
|
|
758
|
-
maxOutputTokens: obj.maxOutputTokens ?? google.maxOutputTokens.default,
|
|
759
|
-
topP: obj.topP ?? google.topP.default,
|
|
760
|
-
topK: obj.topK ?? google.topK.default,
|
|
761
|
-
iconURL: obj.iconURL ?? undefined,
|
|
762
|
-
greeting: obj.greeting ?? undefined,
|
|
763
|
-
spec: obj.spec ?? undefined,
|
|
764
|
-
maxContextTokens: obj.maxContextTokens ?? undefined,
|
|
765
|
-
};
|
|
766
|
-
})
|
|
767
|
-
.catch(() => ({
|
|
768
|
-
model: google.model.default,
|
|
769
|
-
modelLabel: null,
|
|
770
|
-
promptPrefix: null,
|
|
771
|
-
examples: [{ input: { content: '' }, output: { content: '' } }],
|
|
772
|
-
temperature: google.temperature.default,
|
|
773
|
-
maxOutputTokens: google.maxOutputTokens.default,
|
|
774
|
-
topP: google.topP.default,
|
|
775
|
-
topK: google.topK.default,
|
|
776
|
-
iconURL: undefined,
|
|
777
|
-
greeting: undefined,
|
|
778
|
-
spec: undefined,
|
|
779
|
-
maxContextTokens: undefined,
|
|
780
|
-
}));
|
|
769
|
+
.transform((obj: Partial<TConversation>) => removeNullishValues(obj))
|
|
770
|
+
.catch(() => ({}));
|
|
781
771
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
772
|
+
/**
|
|
773
|
+
* TODO: Map the following fields:
|
|
774
|
+
- presence_penalty -> presencePenalty
|
|
775
|
+
- frequency_penalty -> frequencyPenalty
|
|
776
|
+
- stop -> stopSequences
|
|
777
|
+
*/
|
|
778
|
+
export const googleGenConfigSchema = z
|
|
779
|
+
.object({
|
|
780
|
+
maxOutputTokens: coerceNumber.optional(),
|
|
781
|
+
temperature: coerceNumber.optional(),
|
|
782
|
+
topP: coerceNumber.optional(),
|
|
783
|
+
topK: coerceNumber.optional(),
|
|
784
|
+
presencePenalty: coerceNumber.optional(),
|
|
785
|
+
frequencyPenalty: coerceNumber.optional(),
|
|
786
|
+
stopSequences: z.array(z.string()).optional(),
|
|
792
787
|
})
|
|
793
|
-
.
|
|
794
|
-
|
|
795
|
-
model: '',
|
|
796
|
-
jailbreak: obj.jailbreak ?? false,
|
|
797
|
-
systemMessage: obj.systemMessage ?? null,
|
|
798
|
-
context: obj.context ?? null,
|
|
799
|
-
toneStyle: obj.toneStyle ?? 'creative',
|
|
800
|
-
jailbreakConversationId: obj.jailbreakConversationId ?? null,
|
|
801
|
-
conversationSignature: obj.conversationSignature ?? null,
|
|
802
|
-
clientId: obj.clientId ?? null,
|
|
803
|
-
invocationId: obj.invocationId ?? 1,
|
|
804
|
-
}))
|
|
805
|
-
.catch(() => ({
|
|
806
|
-
model: '',
|
|
807
|
-
jailbreak: false,
|
|
808
|
-
systemMessage: null,
|
|
809
|
-
context: null,
|
|
810
|
-
toneStyle: 'creative',
|
|
811
|
-
jailbreakConversationId: null,
|
|
812
|
-
conversationSignature: null,
|
|
813
|
-
clientId: null,
|
|
814
|
-
invocationId: 1,
|
|
815
|
-
}));
|
|
788
|
+
.strip()
|
|
789
|
+
.optional();
|
|
816
790
|
|
|
817
791
|
export const chatGPTBrowserSchema = tConversationSchema
|
|
818
792
|
.pick({
|
|
@@ -894,7 +868,10 @@ export const gptPluginsSchema = tConversationSchema
|
|
|
894
868
|
maxContextTokens: undefined,
|
|
895
869
|
}));
|
|
896
870
|
|
|
897
|
-
export function removeNullishValues<T extends Record<string, unknown>>(
|
|
871
|
+
export function removeNullishValues<T extends Record<string, unknown>>(
|
|
872
|
+
obj: T,
|
|
873
|
+
removeEmptyStrings?: boolean,
|
|
874
|
+
): Partial<T> {
|
|
898
875
|
const newObj: Partial<T> = { ...obj };
|
|
899
876
|
|
|
900
877
|
(Object.keys(newObj) as Array<keyof T>).forEach((key) => {
|
|
@@ -902,6 +879,9 @@ export function removeNullishValues<T extends Record<string, unknown>>(obj: T):
|
|
|
902
879
|
if (value === undefined || value === null) {
|
|
903
880
|
delete newObj[key];
|
|
904
881
|
}
|
|
882
|
+
if (removeEmptyStrings && typeof value === 'string' && value === '') {
|
|
883
|
+
delete newObj[key];
|
|
884
|
+
}
|
|
905
885
|
});
|
|
906
886
|
|
|
907
887
|
return newObj;
|
|
@@ -952,8 +932,7 @@ export const compactAssistantSchema = tConversationSchema
|
|
|
952
932
|
greeting: true,
|
|
953
933
|
spec: true,
|
|
954
934
|
})
|
|
955
|
-
|
|
956
|
-
.transform(removeNullishValues)
|
|
935
|
+
.transform((obj) => removeNullishValues(obj))
|
|
957
936
|
.catch(() => ({}));
|
|
958
937
|
|
|
959
938
|
export const agentsSchema = tConversationSchema
|
|
@@ -1027,6 +1006,7 @@ export const openAISchema = tConversationSchema
|
|
|
1027
1006
|
spec: true,
|
|
1028
1007
|
maxContextTokens: true,
|
|
1029
1008
|
max_tokens: true,
|
|
1009
|
+
reasoning_effort: true,
|
|
1030
1010
|
})
|
|
1031
1011
|
.transform((obj: Partial<TConversation>) => removeNullishValues(obj))
|
|
1032
1012
|
.catch(() => ({}));
|
|
@@ -1077,6 +1057,8 @@ export const anthropicSchema = tConversationSchema
|
|
|
1077
1057
|
topK: true,
|
|
1078
1058
|
resendFiles: true,
|
|
1079
1059
|
promptCache: true,
|
|
1060
|
+
thinking: true,
|
|
1061
|
+
thinkingBudget: true,
|
|
1080
1062
|
artifacts: true,
|
|
1081
1063
|
iconURL: true,
|
|
1082
1064
|
greeting: true,
|
|
@@ -1154,7 +1136,7 @@ export const compactPluginsSchema = tConversationSchema
|
|
|
1154
1136
|
})
|
|
1155
1137
|
.catch(() => ({}));
|
|
1156
1138
|
|
|
1157
|
-
const tBannerSchema = z.object({
|
|
1139
|
+
export const tBannerSchema = z.object({
|
|
1158
1140
|
bannerId: z.string(),
|
|
1159
1141
|
message: z.string(),
|
|
1160
1142
|
displayFrom: z.string(),
|
|
@@ -1172,9 +1154,8 @@ export const compactAgentsSchema = tConversationSchema
|
|
|
1172
1154
|
iconURL: true,
|
|
1173
1155
|
greeting: true,
|
|
1174
1156
|
agent_id: true,
|
|
1175
|
-
resendFiles: true,
|
|
1176
1157
|
instructions: true,
|
|
1177
1158
|
additional_instructions: true,
|
|
1178
1159
|
})
|
|
1179
|
-
.transform(removeNullishValues)
|
|
1160
|
+
.transform((obj) => removeNullishValues(obj))
|
|
1180
1161
|
.catch(() => ({}));
|