@ai-sdk/provider 4.0.0-canary.15 → 4.0.0-canary.16

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,11 @@
1
1
  # @ai-sdk/provider
2
2
 
3
+ ## 4.0.0-canary.16
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
+
3
9
  ## 4.0.0-canary.15
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1985,13 +1985,26 @@ type LanguageModelV4ToolResultOutput = {
1985
1985
  */
1986
1986
  providerOptions?: SharedV4ProviderOptions;
1987
1987
  } | {
1988
- type: 'file-data';
1988
+ type: 'file';
1989
1989
  /**
1990
- * Base-64 encoded media data.
1990
+ * File data as a tagged discriminated union:
1991
+ *
1992
+ * - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
1993
+ * - `{ type: 'url', url }`: a URL that points to the file.
1994
+ * - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
1995
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
1991
1996
  */
1992
- data: string;
1997
+ data: SharedV4FileData;
1993
1998
  /**
1994
- * IANA media type.
1999
+ * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
2000
+ * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
2001
+ *
2002
+ * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
2003
+ * top-level segment alone (e.g. `image`). Providers can use the helpers in
2004
+ * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
2005
+ * `detectMediaType`) to resolve the field according to their API
2006
+ * requirements.
2007
+ *
1995
2008
  * @see https://www.iana.org/assignments/media-types/media-types.xhtml
1996
2009
  */
1997
2010
  mediaType: string;
@@ -2003,32 +2016,6 @@ type LanguageModelV4ToolResultOutput = {
2003
2016
  * Provider-specific options.
2004
2017
  */
2005
2018
  providerOptions?: SharedV4ProviderOptions;
2006
- } | {
2007
- type: 'file-url';
2008
- /**
2009
- * URL of the file.
2010
- */
2011
- url: string;
2012
- /**
2013
- * IANA media type.
2014
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
2015
- */
2016
- mediaType: string;
2017
- /**
2018
- * Provider-specific options.
2019
- */
2020
- providerOptions?: SharedV4ProviderOptions;
2021
- } | {
2022
- type: 'file-reference';
2023
- /**
2024
- * Provider-specific references for the file.
2025
- * The key is the provider name, e.g. 'openai' or 'anthropic'.
2026
- */
2027
- providerReference: SharedV4ProviderReference;
2028
- /**
2029
- * Provider-specific options.
2030
- */
2031
- providerOptions?: SharedV4ProviderOptions;
2032
2019
  } | {
2033
2020
  /**
2034
2021
  * Custom content part. This can be used to implement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider",
3
- "version": "4.0.0-canary.15",
3
+ "version": "4.0.0-canary.16",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -5,7 +5,6 @@ import type {
5
5
  SharedV4FileDataUrl,
6
6
  } from '../../shared/v4/shared-v4-file-data';
7
7
  import type { SharedV4ProviderOptions } from '../../shared/v4/shared-v4-provider-options';
8
- import type { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
9
8
 
10
9
  /**
11
10
  * A prompt is a list of messages.
@@ -359,15 +358,28 @@ export type LanguageModelV4ToolResultOutput =
359
358
  providerOptions?: SharedV4ProviderOptions;
360
359
  }
361
360
  | {
362
- type: 'file-data';
361
+ type: 'file';
363
362
 
364
363
  /**
365
- * Base-64 encoded media data.
364
+ * File data as a tagged discriminated union:
365
+ *
366
+ * - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
367
+ * - `{ type: 'url', url }`: a URL that points to the file.
368
+ * - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
369
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
366
370
  */
367
- data: string;
371
+ data: SharedV4FileData;
368
372
 
369
373
  /**
370
- * IANA media type.
374
+ * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
375
+ * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
376
+ *
377
+ * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
378
+ * top-level segment alone (e.g. `image`). Providers can use the helpers in
379
+ * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
380
+ * `detectMediaType`) to resolve the field according to their API
381
+ * requirements.
382
+ *
371
383
  * @see https://www.iana.org/assignments/media-types/media-types.xhtml
372
384
  */
373
385
  mediaType: string;
@@ -377,39 +389,6 @@ export type LanguageModelV4ToolResultOutput =
377
389
  */
378
390
  filename?: string;
379
391
 
380
- /**
381
- * Provider-specific options.
382
- */
383
- providerOptions?: SharedV4ProviderOptions;
384
- }
385
- | {
386
- type: 'file-url';
387
-
388
- /**
389
- * URL of the file.
390
- */
391
- url: string;
392
-
393
- /**
394
- * IANA media type.
395
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
396
- */
397
- mediaType: string;
398
-
399
- /**
400
- * Provider-specific options.
401
- */
402
- providerOptions?: SharedV4ProviderOptions;
403
- }
404
- | {
405
- type: 'file-reference';
406
-
407
- /**
408
- * Provider-specific references for the file.
409
- * The key is the provider name, e.g. 'openai' or 'anthropic'.
410
- */
411
- providerReference: SharedV4ProviderReference;
412
-
413
392
  /**
414
393
  * Provider-specific options.
415
394
  */