@aigne/core 1.58.1 → 1.58.2
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
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.58.2](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.58.1...core-v1.58.2) (2025-09-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **model:** transform local file to base64 before request llm ([#462](https://github.com/AIGNE-io/aigne-framework/issues/462)) ([58ef5d7](https://github.com/AIGNE-io/aigne-framework/commit/58ef5d77046c49f3c4eed15b7f0cc283cbbcd74a))
|
|
9
|
+
|
|
3
10
|
## [1.58.1](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.58.0...core-v1.58.1) (2025-09-05)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -224,11 +224,11 @@ export declare const fileContentBaseSchema: z.ZodObject<{
|
|
|
224
224
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
225
225
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
226
226
|
}, "strip", z.ZodTypeAny, {
|
|
227
|
-
filename?: string | undefined;
|
|
228
227
|
mimeType?: string | undefined;
|
|
229
|
-
}, {
|
|
230
228
|
filename?: string | undefined;
|
|
229
|
+
}, {
|
|
231
230
|
mimeType?: string | undefined;
|
|
231
|
+
filename?: string | undefined;
|
|
232
232
|
}>;
|
|
233
233
|
/**
|
|
234
234
|
* Image URL content type
|
|
@@ -248,13 +248,13 @@ export declare const urlContentSchema: z.ZodObject<{
|
|
|
248
248
|
}, "strip", z.ZodTypeAny, {
|
|
249
249
|
type: "url";
|
|
250
250
|
url: string;
|
|
251
|
-
filename?: string | undefined;
|
|
252
251
|
mimeType?: string | undefined;
|
|
252
|
+
filename?: string | undefined;
|
|
253
253
|
}, {
|
|
254
254
|
type: "url";
|
|
255
255
|
url: string;
|
|
256
|
-
filename?: string | undefined;
|
|
257
256
|
mimeType?: string | undefined;
|
|
257
|
+
filename?: string | undefined;
|
|
258
258
|
}>;
|
|
259
259
|
export interface FileContent extends FileContentBase {
|
|
260
260
|
type: "file";
|
|
@@ -269,13 +269,13 @@ export declare const fileContentSchema: z.ZodObject<{
|
|
|
269
269
|
}, "strip", z.ZodTypeAny, {
|
|
270
270
|
type: "file";
|
|
271
271
|
data: string;
|
|
272
|
-
filename?: string | undefined;
|
|
273
272
|
mimeType?: string | undefined;
|
|
273
|
+
filename?: string | undefined;
|
|
274
274
|
}, {
|
|
275
275
|
type: "file";
|
|
276
276
|
data: string;
|
|
277
|
-
filename?: string | undefined;
|
|
278
277
|
mimeType?: string | undefined;
|
|
278
|
+
filename?: string | undefined;
|
|
279
279
|
}>;
|
|
280
280
|
export interface LocalContent extends FileContentBase {
|
|
281
281
|
type: "local";
|
|
@@ -290,13 +290,13 @@ export declare const localContentSchema: z.ZodObject<{
|
|
|
290
290
|
}, "strip", z.ZodTypeAny, {
|
|
291
291
|
path: string;
|
|
292
292
|
type: "local";
|
|
293
|
-
filename?: string | undefined;
|
|
294
293
|
mimeType?: string | undefined;
|
|
294
|
+
filename?: string | undefined;
|
|
295
295
|
}, {
|
|
296
296
|
path: string;
|
|
297
297
|
type: "local";
|
|
298
|
-
filename?: string | undefined;
|
|
299
298
|
mimeType?: string | undefined;
|
|
299
|
+
filename?: string | undefined;
|
|
300
300
|
}>;
|
|
301
301
|
export type FileUnionContent = LocalContent | UrlContent | FileContent;
|
|
302
302
|
export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -308,13 +308,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
308
308
|
}, "strip", z.ZodTypeAny, {
|
|
309
309
|
path: string;
|
|
310
310
|
type: "local";
|
|
311
|
-
filename?: string | undefined;
|
|
312
311
|
mimeType?: string | undefined;
|
|
312
|
+
filename?: string | undefined;
|
|
313
313
|
}, {
|
|
314
314
|
path: string;
|
|
315
315
|
type: "local";
|
|
316
|
-
filename?: string | undefined;
|
|
317
316
|
mimeType?: string | undefined;
|
|
317
|
+
filename?: string | undefined;
|
|
318
318
|
}>, z.ZodObject<{
|
|
319
319
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
320
320
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -324,13 +324,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
324
324
|
}, "strip", z.ZodTypeAny, {
|
|
325
325
|
type: "url";
|
|
326
326
|
url: string;
|
|
327
|
-
filename?: string | undefined;
|
|
328
327
|
mimeType?: string | undefined;
|
|
328
|
+
filename?: string | undefined;
|
|
329
329
|
}, {
|
|
330
330
|
type: "url";
|
|
331
331
|
url: string;
|
|
332
|
-
filename?: string | undefined;
|
|
333
332
|
mimeType?: string | undefined;
|
|
333
|
+
filename?: string | undefined;
|
|
334
334
|
}>, z.ZodObject<{
|
|
335
335
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
336
336
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -340,13 +340,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
340
340
|
}, "strip", z.ZodTypeAny, {
|
|
341
341
|
type: "file";
|
|
342
342
|
data: string;
|
|
343
|
-
filename?: string | undefined;
|
|
344
343
|
mimeType?: string | undefined;
|
|
344
|
+
filename?: string | undefined;
|
|
345
345
|
}, {
|
|
346
346
|
type: "file";
|
|
347
347
|
data: string;
|
|
348
|
-
filename?: string | undefined;
|
|
349
348
|
mimeType?: string | undefined;
|
|
349
|
+
filename?: string | undefined;
|
|
350
350
|
}>]>;
|
|
351
351
|
export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
352
352
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -357,13 +357,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
357
357
|
}, "strip", z.ZodTypeAny, {
|
|
358
358
|
path: string;
|
|
359
359
|
type: "local";
|
|
360
|
-
filename?: string | undefined;
|
|
361
360
|
mimeType?: string | undefined;
|
|
361
|
+
filename?: string | undefined;
|
|
362
362
|
}, {
|
|
363
363
|
path: string;
|
|
364
364
|
type: "local";
|
|
365
|
-
filename?: string | undefined;
|
|
366
365
|
mimeType?: string | undefined;
|
|
366
|
+
filename?: string | undefined;
|
|
367
367
|
}>, z.ZodObject<{
|
|
368
368
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
369
369
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -373,13 +373,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
373
373
|
}, "strip", z.ZodTypeAny, {
|
|
374
374
|
type: "url";
|
|
375
375
|
url: string;
|
|
376
|
-
filename?: string | undefined;
|
|
377
376
|
mimeType?: string | undefined;
|
|
377
|
+
filename?: string | undefined;
|
|
378
378
|
}, {
|
|
379
379
|
type: "url";
|
|
380
380
|
url: string;
|
|
381
|
-
filename?: string | undefined;
|
|
382
381
|
mimeType?: string | undefined;
|
|
382
|
+
filename?: string | undefined;
|
|
383
383
|
}>, z.ZodObject<{
|
|
384
384
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
385
385
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -389,13 +389,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
389
389
|
}, "strip", z.ZodTypeAny, {
|
|
390
390
|
type: "file";
|
|
391
391
|
data: string;
|
|
392
|
-
filename?: string | undefined;
|
|
393
392
|
mimeType?: string | undefined;
|
|
393
|
+
filename?: string | undefined;
|
|
394
394
|
}, {
|
|
395
395
|
type: "file";
|
|
396
396
|
data: string;
|
|
397
|
-
filename?: string | undefined;
|
|
398
397
|
mimeType?: string | undefined;
|
|
398
|
+
filename?: string | undefined;
|
|
399
399
|
}>]>, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
400
400
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
401
401
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -405,13 +405,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
405
405
|
}, "strip", z.ZodTypeAny, {
|
|
406
406
|
path: string;
|
|
407
407
|
type: "local";
|
|
408
|
-
filename?: string | undefined;
|
|
409
408
|
mimeType?: string | undefined;
|
|
409
|
+
filename?: string | undefined;
|
|
410
410
|
}, {
|
|
411
411
|
path: string;
|
|
412
412
|
type: "local";
|
|
413
|
-
filename?: string | undefined;
|
|
414
413
|
mimeType?: string | undefined;
|
|
414
|
+
filename?: string | undefined;
|
|
415
415
|
}>, z.ZodObject<{
|
|
416
416
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
417
417
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -421,13 +421,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
421
421
|
}, "strip", z.ZodTypeAny, {
|
|
422
422
|
type: "url";
|
|
423
423
|
url: string;
|
|
424
|
-
filename?: string | undefined;
|
|
425
424
|
mimeType?: string | undefined;
|
|
425
|
+
filename?: string | undefined;
|
|
426
426
|
}, {
|
|
427
427
|
type: "url";
|
|
428
428
|
url: string;
|
|
429
|
-
filename?: string | undefined;
|
|
430
429
|
mimeType?: string | undefined;
|
|
430
|
+
filename?: string | undefined;
|
|
431
431
|
}>, z.ZodObject<{
|
|
432
432
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
433
433
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -437,13 +437,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
437
437
|
}, "strip", z.ZodTypeAny, {
|
|
438
438
|
type: "file";
|
|
439
439
|
data: string;
|
|
440
|
-
filename?: string | undefined;
|
|
441
440
|
mimeType?: string | undefined;
|
|
441
|
+
filename?: string | undefined;
|
|
442
442
|
}, {
|
|
443
443
|
type: "file";
|
|
444
444
|
data: string;
|
|
445
|
-
filename?: string | undefined;
|
|
446
445
|
mimeType?: string | undefined;
|
|
446
|
+
filename?: string | undefined;
|
|
447
447
|
}>]>, "many">]>;
|
|
448
448
|
export type UnionContent = TextContent | FileUnionContent;
|
|
449
449
|
export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -464,13 +464,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
464
464
|
}, "strip", z.ZodTypeAny, {
|
|
465
465
|
path: string;
|
|
466
466
|
type: "local";
|
|
467
|
-
filename?: string | undefined;
|
|
468
467
|
mimeType?: string | undefined;
|
|
468
|
+
filename?: string | undefined;
|
|
469
469
|
}, {
|
|
470
470
|
path: string;
|
|
471
471
|
type: "local";
|
|
472
|
-
filename?: string | undefined;
|
|
473
472
|
mimeType?: string | undefined;
|
|
473
|
+
filename?: string | undefined;
|
|
474
474
|
}>, z.ZodObject<{
|
|
475
475
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
476
476
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -480,13 +480,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
480
480
|
}, "strip", z.ZodTypeAny, {
|
|
481
481
|
type: "url";
|
|
482
482
|
url: string;
|
|
483
|
-
filename?: string | undefined;
|
|
484
483
|
mimeType?: string | undefined;
|
|
484
|
+
filename?: string | undefined;
|
|
485
485
|
}, {
|
|
486
486
|
type: "url";
|
|
487
487
|
url: string;
|
|
488
|
-
filename?: string | undefined;
|
|
489
488
|
mimeType?: string | undefined;
|
|
489
|
+
filename?: string | undefined;
|
|
490
490
|
}>, z.ZodObject<{
|
|
491
491
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
492
492
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -496,13 +496,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
496
496
|
}, "strip", z.ZodTypeAny, {
|
|
497
497
|
type: "file";
|
|
498
498
|
data: string;
|
|
499
|
-
filename?: string | undefined;
|
|
500
499
|
mimeType?: string | undefined;
|
|
500
|
+
filename?: string | undefined;
|
|
501
501
|
}, {
|
|
502
502
|
type: "file";
|
|
503
503
|
data: string;
|
|
504
|
-
filename?: string | undefined;
|
|
505
504
|
mimeType?: string | undefined;
|
|
505
|
+
filename?: string | undefined;
|
|
506
506
|
}>]>;
|
|
507
507
|
/**
|
|
508
508
|
* Model response format settings
|
|
@@ -173,6 +173,25 @@ class ChatModel extends agent_js_1.Agent {
|
|
|
173
173
|
enumerable: false,
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
+
input.messages = await Promise.all(input.messages.map(async (message) => {
|
|
177
|
+
if (!Array.isArray(message.content))
|
|
178
|
+
return message;
|
|
179
|
+
return {
|
|
180
|
+
...message,
|
|
181
|
+
content: await Promise.all(message.content.map(async (item) => {
|
|
182
|
+
if (item.type === "local") {
|
|
183
|
+
return {
|
|
184
|
+
...item,
|
|
185
|
+
type: "file",
|
|
186
|
+
data: await index_js_1.nodejs.fs.readFile(item.path, "base64"),
|
|
187
|
+
path: undefined,
|
|
188
|
+
mimeType: item.mimeType || ChatModel.getMimeType(item.filename || item.path),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return item;
|
|
192
|
+
})),
|
|
193
|
+
};
|
|
194
|
+
}));
|
|
176
195
|
}
|
|
177
196
|
/**
|
|
178
197
|
* Performs postprocessing operations after handling output
|
|
@@ -224,11 +224,11 @@ export declare const fileContentBaseSchema: z.ZodObject<{
|
|
|
224
224
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
225
225
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
226
226
|
}, "strip", z.ZodTypeAny, {
|
|
227
|
-
filename?: string | undefined;
|
|
228
227
|
mimeType?: string | undefined;
|
|
229
|
-
}, {
|
|
230
228
|
filename?: string | undefined;
|
|
229
|
+
}, {
|
|
231
230
|
mimeType?: string | undefined;
|
|
231
|
+
filename?: string | undefined;
|
|
232
232
|
}>;
|
|
233
233
|
/**
|
|
234
234
|
* Image URL content type
|
|
@@ -248,13 +248,13 @@ export declare const urlContentSchema: z.ZodObject<{
|
|
|
248
248
|
}, "strip", z.ZodTypeAny, {
|
|
249
249
|
type: "url";
|
|
250
250
|
url: string;
|
|
251
|
-
filename?: string | undefined;
|
|
252
251
|
mimeType?: string | undefined;
|
|
252
|
+
filename?: string | undefined;
|
|
253
253
|
}, {
|
|
254
254
|
type: "url";
|
|
255
255
|
url: string;
|
|
256
|
-
filename?: string | undefined;
|
|
257
256
|
mimeType?: string | undefined;
|
|
257
|
+
filename?: string | undefined;
|
|
258
258
|
}>;
|
|
259
259
|
export interface FileContent extends FileContentBase {
|
|
260
260
|
type: "file";
|
|
@@ -269,13 +269,13 @@ export declare const fileContentSchema: z.ZodObject<{
|
|
|
269
269
|
}, "strip", z.ZodTypeAny, {
|
|
270
270
|
type: "file";
|
|
271
271
|
data: string;
|
|
272
|
-
filename?: string | undefined;
|
|
273
272
|
mimeType?: string | undefined;
|
|
273
|
+
filename?: string | undefined;
|
|
274
274
|
}, {
|
|
275
275
|
type: "file";
|
|
276
276
|
data: string;
|
|
277
|
-
filename?: string | undefined;
|
|
278
277
|
mimeType?: string | undefined;
|
|
278
|
+
filename?: string | undefined;
|
|
279
279
|
}>;
|
|
280
280
|
export interface LocalContent extends FileContentBase {
|
|
281
281
|
type: "local";
|
|
@@ -290,13 +290,13 @@ export declare const localContentSchema: z.ZodObject<{
|
|
|
290
290
|
}, "strip", z.ZodTypeAny, {
|
|
291
291
|
path: string;
|
|
292
292
|
type: "local";
|
|
293
|
-
filename?: string | undefined;
|
|
294
293
|
mimeType?: string | undefined;
|
|
294
|
+
filename?: string | undefined;
|
|
295
295
|
}, {
|
|
296
296
|
path: string;
|
|
297
297
|
type: "local";
|
|
298
|
-
filename?: string | undefined;
|
|
299
298
|
mimeType?: string | undefined;
|
|
299
|
+
filename?: string | undefined;
|
|
300
300
|
}>;
|
|
301
301
|
export type FileUnionContent = LocalContent | UrlContent | FileContent;
|
|
302
302
|
export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -308,13 +308,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
308
308
|
}, "strip", z.ZodTypeAny, {
|
|
309
309
|
path: string;
|
|
310
310
|
type: "local";
|
|
311
|
-
filename?: string | undefined;
|
|
312
311
|
mimeType?: string | undefined;
|
|
312
|
+
filename?: string | undefined;
|
|
313
313
|
}, {
|
|
314
314
|
path: string;
|
|
315
315
|
type: "local";
|
|
316
|
-
filename?: string | undefined;
|
|
317
316
|
mimeType?: string | undefined;
|
|
317
|
+
filename?: string | undefined;
|
|
318
318
|
}>, z.ZodObject<{
|
|
319
319
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
320
320
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -324,13 +324,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
324
324
|
}, "strip", z.ZodTypeAny, {
|
|
325
325
|
type: "url";
|
|
326
326
|
url: string;
|
|
327
|
-
filename?: string | undefined;
|
|
328
327
|
mimeType?: string | undefined;
|
|
328
|
+
filename?: string | undefined;
|
|
329
329
|
}, {
|
|
330
330
|
type: "url";
|
|
331
331
|
url: string;
|
|
332
|
-
filename?: string | undefined;
|
|
333
332
|
mimeType?: string | undefined;
|
|
333
|
+
filename?: string | undefined;
|
|
334
334
|
}>, z.ZodObject<{
|
|
335
335
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
336
336
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -340,13 +340,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
340
340
|
}, "strip", z.ZodTypeAny, {
|
|
341
341
|
type: "file";
|
|
342
342
|
data: string;
|
|
343
|
-
filename?: string | undefined;
|
|
344
343
|
mimeType?: string | undefined;
|
|
344
|
+
filename?: string | undefined;
|
|
345
345
|
}, {
|
|
346
346
|
type: "file";
|
|
347
347
|
data: string;
|
|
348
|
-
filename?: string | undefined;
|
|
349
348
|
mimeType?: string | undefined;
|
|
349
|
+
filename?: string | undefined;
|
|
350
350
|
}>]>;
|
|
351
351
|
export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
352
352
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -357,13 +357,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
357
357
|
}, "strip", z.ZodTypeAny, {
|
|
358
358
|
path: string;
|
|
359
359
|
type: "local";
|
|
360
|
-
filename?: string | undefined;
|
|
361
360
|
mimeType?: string | undefined;
|
|
361
|
+
filename?: string | undefined;
|
|
362
362
|
}, {
|
|
363
363
|
path: string;
|
|
364
364
|
type: "local";
|
|
365
|
-
filename?: string | undefined;
|
|
366
365
|
mimeType?: string | undefined;
|
|
366
|
+
filename?: string | undefined;
|
|
367
367
|
}>, z.ZodObject<{
|
|
368
368
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
369
369
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -373,13 +373,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
373
373
|
}, "strip", z.ZodTypeAny, {
|
|
374
374
|
type: "url";
|
|
375
375
|
url: string;
|
|
376
|
-
filename?: string | undefined;
|
|
377
376
|
mimeType?: string | undefined;
|
|
377
|
+
filename?: string | undefined;
|
|
378
378
|
}, {
|
|
379
379
|
type: "url";
|
|
380
380
|
url: string;
|
|
381
|
-
filename?: string | undefined;
|
|
382
381
|
mimeType?: string | undefined;
|
|
382
|
+
filename?: string | undefined;
|
|
383
383
|
}>, z.ZodObject<{
|
|
384
384
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
385
385
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -389,13 +389,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
389
389
|
}, "strip", z.ZodTypeAny, {
|
|
390
390
|
type: "file";
|
|
391
391
|
data: string;
|
|
392
|
-
filename?: string | undefined;
|
|
393
392
|
mimeType?: string | undefined;
|
|
393
|
+
filename?: string | undefined;
|
|
394
394
|
}, {
|
|
395
395
|
type: "file";
|
|
396
396
|
data: string;
|
|
397
|
-
filename?: string | undefined;
|
|
398
397
|
mimeType?: string | undefined;
|
|
398
|
+
filename?: string | undefined;
|
|
399
399
|
}>]>, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
400
400
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
401
401
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -405,13 +405,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
405
405
|
}, "strip", z.ZodTypeAny, {
|
|
406
406
|
path: string;
|
|
407
407
|
type: "local";
|
|
408
|
-
filename?: string | undefined;
|
|
409
408
|
mimeType?: string | undefined;
|
|
409
|
+
filename?: string | undefined;
|
|
410
410
|
}, {
|
|
411
411
|
path: string;
|
|
412
412
|
type: "local";
|
|
413
|
-
filename?: string | undefined;
|
|
414
413
|
mimeType?: string | undefined;
|
|
414
|
+
filename?: string | undefined;
|
|
415
415
|
}>, z.ZodObject<{
|
|
416
416
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
417
417
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -421,13 +421,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
421
421
|
}, "strip", z.ZodTypeAny, {
|
|
422
422
|
type: "url";
|
|
423
423
|
url: string;
|
|
424
|
-
filename?: string | undefined;
|
|
425
424
|
mimeType?: string | undefined;
|
|
425
|
+
filename?: string | undefined;
|
|
426
426
|
}, {
|
|
427
427
|
type: "url";
|
|
428
428
|
url: string;
|
|
429
|
-
filename?: string | undefined;
|
|
430
429
|
mimeType?: string | undefined;
|
|
430
|
+
filename?: string | undefined;
|
|
431
431
|
}>, z.ZodObject<{
|
|
432
432
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
433
433
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -437,13 +437,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
437
437
|
}, "strip", z.ZodTypeAny, {
|
|
438
438
|
type: "file";
|
|
439
439
|
data: string;
|
|
440
|
-
filename?: string | undefined;
|
|
441
440
|
mimeType?: string | undefined;
|
|
441
|
+
filename?: string | undefined;
|
|
442
442
|
}, {
|
|
443
443
|
type: "file";
|
|
444
444
|
data: string;
|
|
445
|
-
filename?: string | undefined;
|
|
446
445
|
mimeType?: string | undefined;
|
|
446
|
+
filename?: string | undefined;
|
|
447
447
|
}>]>, "many">]>;
|
|
448
448
|
export type UnionContent = TextContent | FileUnionContent;
|
|
449
449
|
export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -464,13 +464,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
464
464
|
}, "strip", z.ZodTypeAny, {
|
|
465
465
|
path: string;
|
|
466
466
|
type: "local";
|
|
467
|
-
filename?: string | undefined;
|
|
468
467
|
mimeType?: string | undefined;
|
|
468
|
+
filename?: string | undefined;
|
|
469
469
|
}, {
|
|
470
470
|
path: string;
|
|
471
471
|
type: "local";
|
|
472
|
-
filename?: string | undefined;
|
|
473
472
|
mimeType?: string | undefined;
|
|
473
|
+
filename?: string | undefined;
|
|
474
474
|
}>, z.ZodObject<{
|
|
475
475
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
476
476
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -480,13 +480,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
480
480
|
}, "strip", z.ZodTypeAny, {
|
|
481
481
|
type: "url";
|
|
482
482
|
url: string;
|
|
483
|
-
filename?: string | undefined;
|
|
484
483
|
mimeType?: string | undefined;
|
|
484
|
+
filename?: string | undefined;
|
|
485
485
|
}, {
|
|
486
486
|
type: "url";
|
|
487
487
|
url: string;
|
|
488
|
-
filename?: string | undefined;
|
|
489
488
|
mimeType?: string | undefined;
|
|
489
|
+
filename?: string | undefined;
|
|
490
490
|
}>, z.ZodObject<{
|
|
491
491
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
492
492
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -496,13 +496,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
496
496
|
}, "strip", z.ZodTypeAny, {
|
|
497
497
|
type: "file";
|
|
498
498
|
data: string;
|
|
499
|
-
filename?: string | undefined;
|
|
500
499
|
mimeType?: string | undefined;
|
|
500
|
+
filename?: string | undefined;
|
|
501
501
|
}, {
|
|
502
502
|
type: "file";
|
|
503
503
|
data: string;
|
|
504
|
-
filename?: string | undefined;
|
|
505
504
|
mimeType?: string | undefined;
|
|
505
|
+
filename?: string | undefined;
|
|
506
506
|
}>]>;
|
|
507
507
|
/**
|
|
508
508
|
* Model response format settings
|
|
@@ -224,11 +224,11 @@ export declare const fileContentBaseSchema: z.ZodObject<{
|
|
|
224
224
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
225
225
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
226
226
|
}, "strip", z.ZodTypeAny, {
|
|
227
|
-
filename?: string | undefined;
|
|
228
227
|
mimeType?: string | undefined;
|
|
229
|
-
}, {
|
|
230
228
|
filename?: string | undefined;
|
|
229
|
+
}, {
|
|
231
230
|
mimeType?: string | undefined;
|
|
231
|
+
filename?: string | undefined;
|
|
232
232
|
}>;
|
|
233
233
|
/**
|
|
234
234
|
* Image URL content type
|
|
@@ -248,13 +248,13 @@ export declare const urlContentSchema: z.ZodObject<{
|
|
|
248
248
|
}, "strip", z.ZodTypeAny, {
|
|
249
249
|
type: "url";
|
|
250
250
|
url: string;
|
|
251
|
-
filename?: string | undefined;
|
|
252
251
|
mimeType?: string | undefined;
|
|
252
|
+
filename?: string | undefined;
|
|
253
253
|
}, {
|
|
254
254
|
type: "url";
|
|
255
255
|
url: string;
|
|
256
|
-
filename?: string | undefined;
|
|
257
256
|
mimeType?: string | undefined;
|
|
257
|
+
filename?: string | undefined;
|
|
258
258
|
}>;
|
|
259
259
|
export interface FileContent extends FileContentBase {
|
|
260
260
|
type: "file";
|
|
@@ -269,13 +269,13 @@ export declare const fileContentSchema: z.ZodObject<{
|
|
|
269
269
|
}, "strip", z.ZodTypeAny, {
|
|
270
270
|
type: "file";
|
|
271
271
|
data: string;
|
|
272
|
-
filename?: string | undefined;
|
|
273
272
|
mimeType?: string | undefined;
|
|
273
|
+
filename?: string | undefined;
|
|
274
274
|
}, {
|
|
275
275
|
type: "file";
|
|
276
276
|
data: string;
|
|
277
|
-
filename?: string | undefined;
|
|
278
277
|
mimeType?: string | undefined;
|
|
278
|
+
filename?: string | undefined;
|
|
279
279
|
}>;
|
|
280
280
|
export interface LocalContent extends FileContentBase {
|
|
281
281
|
type: "local";
|
|
@@ -290,13 +290,13 @@ export declare const localContentSchema: z.ZodObject<{
|
|
|
290
290
|
}, "strip", z.ZodTypeAny, {
|
|
291
291
|
path: string;
|
|
292
292
|
type: "local";
|
|
293
|
-
filename?: string | undefined;
|
|
294
293
|
mimeType?: string | undefined;
|
|
294
|
+
filename?: string | undefined;
|
|
295
295
|
}, {
|
|
296
296
|
path: string;
|
|
297
297
|
type: "local";
|
|
298
|
-
filename?: string | undefined;
|
|
299
298
|
mimeType?: string | undefined;
|
|
299
|
+
filename?: string | undefined;
|
|
300
300
|
}>;
|
|
301
301
|
export type FileUnionContent = LocalContent | UrlContent | FileContent;
|
|
302
302
|
export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -308,13 +308,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
308
308
|
}, "strip", z.ZodTypeAny, {
|
|
309
309
|
path: string;
|
|
310
310
|
type: "local";
|
|
311
|
-
filename?: string | undefined;
|
|
312
311
|
mimeType?: string | undefined;
|
|
312
|
+
filename?: string | undefined;
|
|
313
313
|
}, {
|
|
314
314
|
path: string;
|
|
315
315
|
type: "local";
|
|
316
|
-
filename?: string | undefined;
|
|
317
316
|
mimeType?: string | undefined;
|
|
317
|
+
filename?: string | undefined;
|
|
318
318
|
}>, z.ZodObject<{
|
|
319
319
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
320
320
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -324,13 +324,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
324
324
|
}, "strip", z.ZodTypeAny, {
|
|
325
325
|
type: "url";
|
|
326
326
|
url: string;
|
|
327
|
-
filename?: string | undefined;
|
|
328
327
|
mimeType?: string | undefined;
|
|
328
|
+
filename?: string | undefined;
|
|
329
329
|
}, {
|
|
330
330
|
type: "url";
|
|
331
331
|
url: string;
|
|
332
|
-
filename?: string | undefined;
|
|
333
332
|
mimeType?: string | undefined;
|
|
333
|
+
filename?: string | undefined;
|
|
334
334
|
}>, z.ZodObject<{
|
|
335
335
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
336
336
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -340,13 +340,13 @@ export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
340
340
|
}, "strip", z.ZodTypeAny, {
|
|
341
341
|
type: "file";
|
|
342
342
|
data: string;
|
|
343
|
-
filename?: string | undefined;
|
|
344
343
|
mimeType?: string | undefined;
|
|
344
|
+
filename?: string | undefined;
|
|
345
345
|
}, {
|
|
346
346
|
type: "file";
|
|
347
347
|
data: string;
|
|
348
|
-
filename?: string | undefined;
|
|
349
348
|
mimeType?: string | undefined;
|
|
349
|
+
filename?: string | undefined;
|
|
350
350
|
}>]>;
|
|
351
351
|
export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
352
352
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -357,13 +357,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
357
357
|
}, "strip", z.ZodTypeAny, {
|
|
358
358
|
path: string;
|
|
359
359
|
type: "local";
|
|
360
|
-
filename?: string | undefined;
|
|
361
360
|
mimeType?: string | undefined;
|
|
361
|
+
filename?: string | undefined;
|
|
362
362
|
}, {
|
|
363
363
|
path: string;
|
|
364
364
|
type: "local";
|
|
365
|
-
filename?: string | undefined;
|
|
366
365
|
mimeType?: string | undefined;
|
|
366
|
+
filename?: string | undefined;
|
|
367
367
|
}>, z.ZodObject<{
|
|
368
368
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
369
369
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -373,13 +373,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
373
373
|
}, "strip", z.ZodTypeAny, {
|
|
374
374
|
type: "url";
|
|
375
375
|
url: string;
|
|
376
|
-
filename?: string | undefined;
|
|
377
376
|
mimeType?: string | undefined;
|
|
377
|
+
filename?: string | undefined;
|
|
378
378
|
}, {
|
|
379
379
|
type: "url";
|
|
380
380
|
url: string;
|
|
381
|
-
filename?: string | undefined;
|
|
382
381
|
mimeType?: string | undefined;
|
|
382
|
+
filename?: string | undefined;
|
|
383
383
|
}>, z.ZodObject<{
|
|
384
384
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
385
385
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -389,13 +389,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
389
389
|
}, "strip", z.ZodTypeAny, {
|
|
390
390
|
type: "file";
|
|
391
391
|
data: string;
|
|
392
|
-
filename?: string | undefined;
|
|
393
392
|
mimeType?: string | undefined;
|
|
393
|
+
filename?: string | undefined;
|
|
394
394
|
}, {
|
|
395
395
|
type: "file";
|
|
396
396
|
data: string;
|
|
397
|
-
filename?: string | undefined;
|
|
398
397
|
mimeType?: string | undefined;
|
|
398
|
+
filename?: string | undefined;
|
|
399
399
|
}>]>, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
400
400
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
401
401
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -405,13 +405,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
405
405
|
}, "strip", z.ZodTypeAny, {
|
|
406
406
|
path: string;
|
|
407
407
|
type: "local";
|
|
408
|
-
filename?: string | undefined;
|
|
409
408
|
mimeType?: string | undefined;
|
|
409
|
+
filename?: string | undefined;
|
|
410
410
|
}, {
|
|
411
411
|
path: string;
|
|
412
412
|
type: "local";
|
|
413
|
-
filename?: string | undefined;
|
|
414
413
|
mimeType?: string | undefined;
|
|
414
|
+
filename?: string | undefined;
|
|
415
415
|
}>, z.ZodObject<{
|
|
416
416
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
417
417
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -421,13 +421,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
421
421
|
}, "strip", z.ZodTypeAny, {
|
|
422
422
|
type: "url";
|
|
423
423
|
url: string;
|
|
424
|
-
filename?: string | undefined;
|
|
425
424
|
mimeType?: string | undefined;
|
|
425
|
+
filename?: string | undefined;
|
|
426
426
|
}, {
|
|
427
427
|
type: "url";
|
|
428
428
|
url: string;
|
|
429
|
-
filename?: string | undefined;
|
|
430
429
|
mimeType?: string | undefined;
|
|
430
|
+
filename?: string | undefined;
|
|
431
431
|
}>, z.ZodObject<{
|
|
432
432
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
433
433
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -437,13 +437,13 @@ export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnio
|
|
|
437
437
|
}, "strip", z.ZodTypeAny, {
|
|
438
438
|
type: "file";
|
|
439
439
|
data: string;
|
|
440
|
-
filename?: string | undefined;
|
|
441
440
|
mimeType?: string | undefined;
|
|
441
|
+
filename?: string | undefined;
|
|
442
442
|
}, {
|
|
443
443
|
type: "file";
|
|
444
444
|
data: string;
|
|
445
|
-
filename?: string | undefined;
|
|
446
445
|
mimeType?: string | undefined;
|
|
446
|
+
filename?: string | undefined;
|
|
447
447
|
}>]>, "many">]>;
|
|
448
448
|
export type UnionContent = TextContent | FileUnionContent;
|
|
449
449
|
export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -464,13 +464,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
464
464
|
}, "strip", z.ZodTypeAny, {
|
|
465
465
|
path: string;
|
|
466
466
|
type: "local";
|
|
467
|
-
filename?: string | undefined;
|
|
468
467
|
mimeType?: string | undefined;
|
|
468
|
+
filename?: string | undefined;
|
|
469
469
|
}, {
|
|
470
470
|
path: string;
|
|
471
471
|
type: "local";
|
|
472
|
-
filename?: string | undefined;
|
|
473
472
|
mimeType?: string | undefined;
|
|
473
|
+
filename?: string | undefined;
|
|
474
474
|
}>, z.ZodObject<{
|
|
475
475
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
476
476
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -480,13 +480,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
480
480
|
}, "strip", z.ZodTypeAny, {
|
|
481
481
|
type: "url";
|
|
482
482
|
url: string;
|
|
483
|
-
filename?: string | undefined;
|
|
484
483
|
mimeType?: string | undefined;
|
|
484
|
+
filename?: string | undefined;
|
|
485
485
|
}, {
|
|
486
486
|
type: "url";
|
|
487
487
|
url: string;
|
|
488
|
-
filename?: string | undefined;
|
|
489
488
|
mimeType?: string | undefined;
|
|
489
|
+
filename?: string | undefined;
|
|
490
490
|
}>, z.ZodObject<{
|
|
491
491
|
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
492
492
|
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -496,13 +496,13 @@ export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
496
496
|
}, "strip", z.ZodTypeAny, {
|
|
497
497
|
type: "file";
|
|
498
498
|
data: string;
|
|
499
|
-
filename?: string | undefined;
|
|
500
499
|
mimeType?: string | undefined;
|
|
500
|
+
filename?: string | undefined;
|
|
501
501
|
}, {
|
|
502
502
|
type: "file";
|
|
503
503
|
data: string;
|
|
504
|
-
filename?: string | undefined;
|
|
505
504
|
mimeType?: string | undefined;
|
|
505
|
+
filename?: string | undefined;
|
|
506
506
|
}>]>;
|
|
507
507
|
/**
|
|
508
508
|
* Model response format settings
|
|
@@ -133,6 +133,25 @@ export class ChatModel extends Agent {
|
|
|
133
133
|
enumerable: false,
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
+
input.messages = await Promise.all(input.messages.map(async (message) => {
|
|
137
|
+
if (!Array.isArray(message.content))
|
|
138
|
+
return message;
|
|
139
|
+
return {
|
|
140
|
+
...message,
|
|
141
|
+
content: await Promise.all(message.content.map(async (item) => {
|
|
142
|
+
if (item.type === "local") {
|
|
143
|
+
return {
|
|
144
|
+
...item,
|
|
145
|
+
type: "file",
|
|
146
|
+
data: await nodejs.fs.readFile(item.path, "base64"),
|
|
147
|
+
path: undefined,
|
|
148
|
+
mimeType: item.mimeType || ChatModel.getMimeType(item.filename || item.path),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return item;
|
|
152
|
+
})),
|
|
153
|
+
};
|
|
154
|
+
}));
|
|
136
155
|
}
|
|
137
156
|
/**
|
|
138
157
|
* Performs postprocessing operations after handling output
|