@ai-sdk/openai 2.0.23 → 2.0.25

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,19 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.25
4
+
5
+ ### Patch Changes
6
+
7
+ - fb45ade: fix timestamp granularities support for openai transcription
8
+
9
+ ## 2.0.24
10
+
11
+ ### Patch Changes
12
+
13
+ - ad57512: fix(provider/openai): safe practice to include filename and fileExtension to avoid `experimental_transcribe` fails with valid Buffer
14
+ - Updated dependencies [99964ed]
15
+ - @ai-sdk/provider-utils@3.0.8
16
+
3
17
  ## 2.0.23
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3499,7 +3499,12 @@ var OpenAITranscriptionModel = class {
3499
3499
  const formData = new FormData();
3500
3500
  const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils14.convertBase64ToUint8Array)(audio)]);
3501
3501
  formData.append("model", this.modelId);
3502
- formData.append("file", new File([blob], "audio", { type: mediaType }));
3502
+ const fileExtension = (0, import_provider_utils14.mediaTypeToExtension)(mediaType);
3503
+ formData.append(
3504
+ "file",
3505
+ new File([blob], "audio", { type: mediaType }),
3506
+ `audio.${fileExtension}`
3507
+ );
3503
3508
  if (openAIOptions) {
3504
3509
  const transcriptionModelOptions = {
3505
3510
  include: openAIOptions.include,
@@ -3516,7 +3521,13 @@ var OpenAITranscriptionModel = class {
3516
3521
  };
3517
3522
  for (const [key, value] of Object.entries(transcriptionModelOptions)) {
3518
3523
  if (value != null) {
3519
- formData.append(key, String(value));
3524
+ if (Array.isArray(value)) {
3525
+ for (const item of value) {
3526
+ formData.append(`${key}[]`, String(item));
3527
+ }
3528
+ } else {
3529
+ formData.append(key, String(value));
3530
+ }
3520
3531
  }
3521
3532
  }
3522
3533
  }