@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 +14 -0
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +13 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3418,6 +3418,7 @@ import {
|
|
|
3418
3418
|
combineHeaders as combineHeaders7,
|
|
3419
3419
|
convertBase64ToUint8Array,
|
|
3420
3420
|
createJsonResponseHandler as createJsonResponseHandler6,
|
|
3421
|
+
mediaTypeToExtension,
|
|
3421
3422
|
parseProviderOptions as parseProviderOptions7,
|
|
3422
3423
|
postFormDataToApi
|
|
3423
3424
|
} from "@ai-sdk/provider-utils";
|
|
@@ -3533,7 +3534,12 @@ var OpenAITranscriptionModel = class {
|
|
|
3533
3534
|
const formData = new FormData();
|
|
3534
3535
|
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([convertBase64ToUint8Array(audio)]);
|
|
3535
3536
|
formData.append("model", this.modelId);
|
|
3536
|
-
|
|
3537
|
+
const fileExtension = mediaTypeToExtension(mediaType);
|
|
3538
|
+
formData.append(
|
|
3539
|
+
"file",
|
|
3540
|
+
new File([blob], "audio", { type: mediaType }),
|
|
3541
|
+
`audio.${fileExtension}`
|
|
3542
|
+
);
|
|
3537
3543
|
if (openAIOptions) {
|
|
3538
3544
|
const transcriptionModelOptions = {
|
|
3539
3545
|
include: openAIOptions.include,
|
|
@@ -3550,7 +3556,13 @@ var OpenAITranscriptionModel = class {
|
|
|
3550
3556
|
};
|
|
3551
3557
|
for (const [key, value] of Object.entries(transcriptionModelOptions)) {
|
|
3552
3558
|
if (value != null) {
|
|
3553
|
-
|
|
3559
|
+
if (Array.isArray(value)) {
|
|
3560
|
+
for (const item of value) {
|
|
3561
|
+
formData.append(`${key}[]`, String(item));
|
|
3562
|
+
}
|
|
3563
|
+
} else {
|
|
3564
|
+
formData.append(key, String(value));
|
|
3565
|
+
}
|
|
3554
3566
|
}
|
|
3555
3567
|
}
|
|
3556
3568
|
}
|