ai 7.0.0-beta.72 → 7.0.0-beta.74

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,22 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.0-beta.74
4
+
5
+ ### Patch Changes
6
+
7
+ - e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
8
+ - Updated dependencies [e311194]
9
+ - @ai-sdk/provider@4.0.0-beta.9
10
+ - @ai-sdk/gateway@4.0.0-beta.42
11
+ - @ai-sdk/provider-utils@5.0.0-beta.15
12
+
13
+ ## 7.0.0-beta.73
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [1464561]
18
+ - @ai-sdk/gateway@4.0.0-beta.41
19
+
3
20
  ## 7.0.0-beta.72
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -7204,7 +7204,7 @@ type UploadSkillResult = Omit<SkillsV4UploadResult, 'providerReference' | 'warni
7204
7204
  };
7205
7205
 
7206
7206
  declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
7207
- api: SkillsV4;
7207
+ api: SkillsV4 | ProviderV4;
7208
7208
  files: SkillsV4File[];
7209
7209
  displayTitle?: string;
7210
7210
  providerOptions?: ProviderOptions;
@@ -7370,8 +7370,9 @@ interface UploadFileResult {
7370
7370
  declare function uploadFile({ api, data: dataArg, mediaType: mediaTypeArg, filename, providerOptions, }: {
7371
7371
  /**
7372
7372
  * The files API interface to use for uploading.
7373
+ * Can be a `FilesV4` instance or a `ProviderV4` instance with a `files()` method.
7373
7374
  */
7374
- api: FilesV4;
7375
+ api: FilesV4 | ProviderV4;
7375
7376
  /**
7376
7377
  * The file data to upload.
7377
7378
  */
package/dist/index.d.ts CHANGED
@@ -7204,7 +7204,7 @@ type UploadSkillResult = Omit<SkillsV4UploadResult, 'providerReference' | 'warni
7204
7204
  };
7205
7205
 
7206
7206
  declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
7207
- api: SkillsV4;
7207
+ api: SkillsV4 | ProviderV4;
7208
7208
  files: SkillsV4File[];
7209
7209
  displayTitle?: string;
7210
7210
  providerOptions?: ProviderOptions;
@@ -7370,8 +7370,9 @@ interface UploadFileResult {
7370
7370
  declare function uploadFile({ api, data: dataArg, mediaType: mediaTypeArg, filename, providerOptions, }: {
7371
7371
  /**
7372
7372
  * The files API interface to use for uploading.
7373
+ * Can be a `FilesV4` instance or a `ProviderV4` instance with a `files()` method.
7373
7374
  */
7374
- api: FilesV4;
7375
+ api: FilesV4 | ProviderV4;
7375
7376
  /**
7376
7377
  * The file data to upload.
7377
7378
  */
package/dist/index.js CHANGED
@@ -1401,7 +1401,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
1401
1401
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
1402
1402
 
1403
1403
  // src/version.ts
1404
- var VERSION = true ? "7.0.0-beta.72" : "0.0.0-test";
1404
+ var VERSION = true ? "7.0.0-beta.74" : "0.0.0-test";
1405
1405
 
1406
1406
  // src/util/download/download.ts
1407
1407
  var download = async ({
@@ -12791,7 +12791,12 @@ async function uploadSkill({
12791
12791
  displayTitle,
12792
12792
  providerOptions
12793
12793
  }) {
12794
- const result = await api.upload({
12794
+ const skillsApi = "uploadSkill" in api ? api : typeof api.skills === "function" ? api.skills() : (() => {
12795
+ throw new Error(
12796
+ "The provider does not support skills. Make sure it exposes a skills() method."
12797
+ );
12798
+ })();
12799
+ const result = await skillsApi.uploadSkill({
12795
12800
  files,
12796
12801
  displayTitle,
12797
12802
  providerOptions
@@ -13709,7 +13714,12 @@ async function uploadFile({
13709
13714
  ...videoMediaTypeSignatures
13710
13715
  ]
13711
13716
  })) != null ? _a21 : isLikelyText(data) ? "text/plain" : "application/octet-stream";
13712
- const result = await api.uploadFile({
13717
+ const filesApi = "uploadFile" in api ? api : typeof api.files === "function" ? api.files() : (() => {
13718
+ throw new Error(
13719
+ "The provider does not support file uploads. Make sure it exposes a files() method."
13720
+ );
13721
+ })();
13722
+ const result = await filesApi.uploadFile({
13713
13723
  data,
13714
13724
  mediaType,
13715
13725
  filename,