@ai-sdk/openai 2.0.136 → 2.0.137
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 +6 -0
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +13 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +13 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5116,7 +5116,12 @@ var openaiTranscriptionResponseSchema = lazyValidator12(
|
|
|
5116
5116
|
compression_ratio: z20.number(),
|
|
5117
5117
|
no_speech_prob: z20.number()
|
|
5118
5118
|
})
|
|
5119
|
-
).nullish()
|
|
5119
|
+
).nullish(),
|
|
5120
|
+
// Lenient: an unexpected usage shape must not fail the transcription.
|
|
5121
|
+
usage: z20.object({
|
|
5122
|
+
type: z20.string().nullish(),
|
|
5123
|
+
seconds: z20.number().nullish()
|
|
5124
|
+
}).nullish().catch(void 0)
|
|
5120
5125
|
})
|
|
5121
5126
|
)
|
|
5122
5127
|
);
|
|
@@ -5252,10 +5257,10 @@ var OpenAITranscriptionModel = class {
|
|
|
5252
5257
|
prompt: openAIOptions.prompt,
|
|
5253
5258
|
// https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
|
|
5254
5259
|
// prefer verbose_json to get segments for models that support it
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5260
|
+
// gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
|
|
5261
|
+
response_format: ["gpt-4o-transcribe", "gpt-4o-mini-transcribe"].includes(
|
|
5262
|
+
this.modelId
|
|
5263
|
+
) || this.modelId.startsWith("gpt-4o-mini-transcribe-") || this.modelId === "gpt-transcribe" || this.modelId.startsWith("gpt-transcribe-") ? "json" : "verbose_json",
|
|
5259
5264
|
temperature: openAIOptions.temperature,
|
|
5260
5265
|
timestamp_granularities: openAIOptions.timestampGranularities
|
|
5261
5266
|
};
|
|
@@ -5277,7 +5282,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5277
5282
|
};
|
|
5278
5283
|
}
|
|
5279
5284
|
async doGenerate(options) {
|
|
5280
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5285
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5281
5286
|
const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
|
|
5282
5287
|
const { formData, warnings } = await this.getArgs(options);
|
|
5283
5288
|
const {
|
|
@@ -5311,7 +5316,8 @@ var OpenAITranscriptionModel = class {
|
|
|
5311
5316
|
endSecond: word.end
|
|
5312
5317
|
}))) != null ? _g : [],
|
|
5313
5318
|
language,
|
|
5314
|
-
|
|
5319
|
+
// Duration-billed json responses report the duration only in `usage`:
|
|
5320
|
+
durationInSeconds: (_j = response.duration) != null ? _j : ((_h = response.usage) == null ? void 0 : _h.type) === "duration" ? (_i = response.usage.seconds) != null ? _i : void 0 : void 0,
|
|
5315
5321
|
warnings,
|
|
5316
5322
|
response: {
|
|
5317
5323
|
timestamp: currentDate,
|
|
@@ -5324,7 +5330,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5324
5330
|
};
|
|
5325
5331
|
|
|
5326
5332
|
// src/version.ts
|
|
5327
|
-
var VERSION = true ? "2.0.
|
|
5333
|
+
var VERSION = true ? "2.0.137" : "0.0.0-test";
|
|
5328
5334
|
|
|
5329
5335
|
// src/openai-provider.ts
|
|
5330
5336
|
function createOpenAI(options = {}) {
|