@ai-sdk/provider-utils 5.0.0-canary.31 → 5.0.0-canary.32
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 +11 -0
- package/dist/index.d.ts +69 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/types/content-part.ts +67 -6
- package/src/types/tool.ts +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 5.0.0-canary.32
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5463d0d]
|
|
12
|
+
- @ai-sdk/provider@4.0.0-canary.16
|
|
13
|
+
|
|
3
14
|
## 5.0.0-canary.31
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -348,6 +348,45 @@ type ToolResultOutput = {
|
|
|
348
348
|
*/
|
|
349
349
|
providerOptions?: ProviderOptions;
|
|
350
350
|
} | {
|
|
351
|
+
type: 'file';
|
|
352
|
+
/**
|
|
353
|
+
* File data as a tagged discriminated union:
|
|
354
|
+
*
|
|
355
|
+
* - `{ type: 'data', data }`: raw bytes
|
|
356
|
+
* (base64 string, Uint8Array, ArrayBuffer, Buffer)
|
|
357
|
+
* - `{ type: 'url', url }`: a URL that points to the file
|
|
358
|
+
* - `{ type: 'reference', reference }`: a provider reference
|
|
359
|
+
* from `uploadFile`
|
|
360
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline
|
|
361
|
+
* text document)
|
|
362
|
+
*/
|
|
363
|
+
data: FileData;
|
|
364
|
+
/**
|
|
365
|
+
* Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
|
|
366
|
+
* the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
|
|
367
|
+
*
|
|
368
|
+
* `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
|
|
369
|
+
* top-level segment alone (e.g. `image`). Providers can use the helpers in
|
|
370
|
+
* `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
|
|
371
|
+
* `detectMediaType`) to resolve the field according to their API
|
|
372
|
+
* requirements.
|
|
373
|
+
*
|
|
374
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
375
|
+
*/
|
|
376
|
+
mediaType: string;
|
|
377
|
+
/**
|
|
378
|
+
* Optional filename of the file.
|
|
379
|
+
*/
|
|
380
|
+
filename?: string;
|
|
381
|
+
/**
|
|
382
|
+
* Provider-specific options.
|
|
383
|
+
*/
|
|
384
|
+
providerOptions?: ProviderOptions;
|
|
385
|
+
} | {
|
|
386
|
+
/**
|
|
387
|
+
* @deprecated Use 'file' with mediaType + tagged data instead:
|
|
388
|
+
* `{ type: 'file', mediaType, data: { type: 'data', data } }`.
|
|
389
|
+
*/
|
|
351
390
|
type: 'file-data';
|
|
352
391
|
/**
|
|
353
392
|
* Base-64 encoded media data.
|
|
@@ -367,6 +406,10 @@ type ToolResultOutput = {
|
|
|
367
406
|
*/
|
|
368
407
|
providerOptions?: ProviderOptions;
|
|
369
408
|
} | {
|
|
409
|
+
/**
|
|
410
|
+
* @deprecated Use 'file' with mediaType and tagged data instead:
|
|
411
|
+
* `{ type: 'file', mediaType, data: { type: 'url', url: new URL(url) } }`.
|
|
412
|
+
*/
|
|
370
413
|
type: 'file-url';
|
|
371
414
|
/**
|
|
372
415
|
* URL of the file.
|
|
@@ -383,7 +426,8 @@ type ToolResultOutput = {
|
|
|
383
426
|
providerOptions?: ProviderOptions;
|
|
384
427
|
} | {
|
|
385
428
|
/**
|
|
386
|
-
* @deprecated Use file
|
|
429
|
+
* @deprecated Use 'file' with tagged data instead:
|
|
430
|
+
* `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
|
|
387
431
|
*/
|
|
388
432
|
type: 'file-id';
|
|
389
433
|
/**
|
|
@@ -400,6 +444,10 @@ type ToolResultOutput = {
|
|
|
400
444
|
*/
|
|
401
445
|
providerOptions?: ProviderOptions;
|
|
402
446
|
} | {
|
|
447
|
+
/**
|
|
448
|
+
* @deprecated Use 'file' with tagged data instead:
|
|
449
|
+
* `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
|
|
450
|
+
*/
|
|
403
451
|
type: 'file-reference';
|
|
404
452
|
/**
|
|
405
453
|
* Provider-specific references for the file.
|
|
@@ -412,7 +460,9 @@ type ToolResultOutput = {
|
|
|
412
460
|
providerOptions?: ProviderOptions;
|
|
413
461
|
} | {
|
|
414
462
|
/**
|
|
415
|
-
* @deprecated Use file
|
|
463
|
+
* @deprecated Use 'file' with mediaType (e.g. 'image' or a specific
|
|
464
|
+
* `image/*` subtype) and tagged data instead:
|
|
465
|
+
* `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
|
|
416
466
|
*/
|
|
417
467
|
type: 'image-data';
|
|
418
468
|
/**
|
|
@@ -430,7 +480,9 @@ type ToolResultOutput = {
|
|
|
430
480
|
providerOptions?: ProviderOptions;
|
|
431
481
|
} | {
|
|
432
482
|
/**
|
|
433
|
-
* @deprecated Use file
|
|
483
|
+
* @deprecated Use 'file' with `mediaType: 'image'` (or a specific
|
|
484
|
+
* `image/*` subtype) and tagged data instead:
|
|
485
|
+
* `{ type: 'file', mediaType: 'image', data: { type: 'url', url: new URL(url) } }`.
|
|
434
486
|
*/
|
|
435
487
|
type: 'image-url';
|
|
436
488
|
/**
|
|
@@ -443,7 +495,9 @@ type ToolResultOutput = {
|
|
|
443
495
|
providerOptions?: ProviderOptions;
|
|
444
496
|
} | {
|
|
445
497
|
/**
|
|
446
|
-
* @deprecated Use file
|
|
498
|
+
* @deprecated Use 'file' with `mediaType: 'image'` (or a specific
|
|
499
|
+
* `image/*` subtype) and tagged data instead:
|
|
500
|
+
* `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
|
|
447
501
|
*/
|
|
448
502
|
type: 'image-file-id';
|
|
449
503
|
/**
|
|
@@ -461,7 +515,9 @@ type ToolResultOutput = {
|
|
|
461
515
|
providerOptions?: ProviderOptions;
|
|
462
516
|
} | {
|
|
463
517
|
/**
|
|
464
|
-
* @deprecated Use file
|
|
518
|
+
* @deprecated Use 'file' with `mediaType: 'image'` (or a specific
|
|
519
|
+
* `image/*` subtype) and tagged data instead:
|
|
520
|
+
* `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
|
|
465
521
|
*/
|
|
466
522
|
type: 'image-file-reference';
|
|
467
523
|
/**
|
|
@@ -1447,14 +1503,16 @@ type BaseFunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT ex
|
|
|
1447
1503
|
supportsDeferredResults?: never;
|
|
1448
1504
|
};
|
|
1449
1505
|
/**
|
|
1450
|
-
* Tool with user-defined input and output schemas.
|
|
1506
|
+
* Tool with user-defined input and output schemas that is executed by the AI SDK.
|
|
1451
1507
|
*/
|
|
1452
1508
|
type FunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseFunctionTool<INPUT, OUTPUT, CONTEXT> & {
|
|
1453
1509
|
type?: undefined | 'function';
|
|
1454
1510
|
};
|
|
1455
1511
|
/**
|
|
1456
|
-
* Tool that is defined at runtime
|
|
1512
|
+
* Tool that is defined at runtime.
|
|
1457
1513
|
* The types of input and output are not known at development time.
|
|
1514
|
+
*
|
|
1515
|
+
* For example, MCP tools that are not known at development time.
|
|
1458
1516
|
*/
|
|
1459
1517
|
type DynamicTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseFunctionTool<INPUT, OUTPUT, CONTEXT> & {
|
|
1460
1518
|
type: 'dynamic';
|
|
@@ -1479,6 +1537,8 @@ type BaseProviderTool<INPUT extends JSONValue | unknown | never = any, OUTPUT ex
|
|
|
1479
1537
|
/**
|
|
1480
1538
|
* Tool with provider-defined input and output schemas that is executed by the
|
|
1481
1539
|
* user.
|
|
1540
|
+
*
|
|
1541
|
+
* For example, shell tools that are executed in a local shell, but have provider-defined input and output schemas.
|
|
1482
1542
|
*/
|
|
1483
1543
|
type ProviderDefinedTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseProviderTool<INPUT, OUTPUT, CONTEXT> & {
|
|
1484
1544
|
/**
|
|
@@ -1490,6 +1550,8 @@ type ProviderDefinedTool<INPUT extends JSONValue | unknown | never = any, OUTPUT
|
|
|
1490
1550
|
/**
|
|
1491
1551
|
* Tool with provider-defined input and output schemas that is executed by the
|
|
1492
1552
|
* provider.
|
|
1553
|
+
*
|
|
1554
|
+
* For example, web search tools and code execution tools that are executed by the provider itself.
|
|
1493
1555
|
*/
|
|
1494
1556
|
type ProviderExecutedTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseProviderTool<INPUT, OUTPUT, CONTEXT> & {
|
|
1495
1557
|
/**
|
package/dist/index.js
CHANGED
|
@@ -862,7 +862,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
862
862
|
}
|
|
863
863
|
|
|
864
864
|
// src/version.ts
|
|
865
|
-
var VERSION = true ? "5.0.0-canary.
|
|
865
|
+
var VERSION = true ? "5.0.0-canary.32" : "0.0.0-test";
|
|
866
866
|
|
|
867
867
|
// src/get-from-api.ts
|
|
868
868
|
var getOriginalFetch = () => globalThis.fetch;
|