@ai-sdk/openai 3.0.132 → 3.0.134
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +233 -217
- package/dist/internal/index.d.ts +233 -217
- package/dist/internal/index.js +26 -11
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +25 -11
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +4 -3
- package/package.json +3 -3
- package/src/chat/openai-chat-options.ts +1 -0
- package/src/openai-language-model-capabilities.ts +5 -2
- package/src/responses/openai-responses-language-model.ts +16 -2
- package/src/responses/openai-responses-options.ts +2 -0
- package/src/transcription/openai-transcription-api.ts +8 -0
- package/src/transcription/openai-transcription-model.ts +16 -7
package/dist/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
54
54
|
const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a2 = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a2.startsWith("chat")) != null ? _b : false);
|
|
55
55
|
const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
|
|
56
56
|
const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
|
|
57
|
-
const
|
|
57
|
+
const isGpt6OrLaterModelWithNoneEffort = modelId === "gpt-6-sol" || modelId === "gpt-6-luna" || modelId === "gpt-6.1-terra";
|
|
58
58
|
const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
59
59
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
|
|
60
60
|
const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
@@ -65,7 +65,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
65
65
|
supportsPriorityProcessing,
|
|
66
66
|
supportsConfigurationUpdate: isGpt6OrLaterModel,
|
|
67
67
|
supportsAsyncToolCalling: isGpt6OrLaterModel,
|
|
68
|
-
supportedReasoningEfforts:
|
|
68
|
+
supportedReasoningEfforts: isGpt6OrLaterModelWithNoneEffort ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
69
69
|
isReasoningModel,
|
|
70
70
|
systemMessageMode,
|
|
71
71
|
supportsNonReasoningParameters
|
|
@@ -3237,6 +3237,7 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3237
3237
|
"gpt-5.6-terra",
|
|
3238
3238
|
"gpt-6-astra",
|
|
3239
3239
|
"gpt-6.1-sol",
|
|
3240
|
+
"gpt-6.1-terra",
|
|
3240
3241
|
"gpt-6-luna",
|
|
3241
3242
|
"gpt-6-sol"
|
|
3242
3243
|
];
|
|
@@ -6771,7 +6772,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6771
6772
|
toolName: toolNameMapping.toCustomToolName(
|
|
6772
6773
|
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
6773
6774
|
),
|
|
6774
|
-
|
|
6775
|
+
...mapWebSearchResult(part)
|
|
6775
6776
|
});
|
|
6776
6777
|
break;
|
|
6777
6778
|
}
|
|
@@ -7375,7 +7376,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7375
7376
|
toolName: toolNameMapping.toCustomToolName(
|
|
7376
7377
|
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
7377
7378
|
),
|
|
7378
|
-
|
|
7379
|
+
...mapWebSearchResult(value.item)
|
|
7379
7380
|
});
|
|
7380
7381
|
} else if (value.item.type === "computer_call") {
|
|
7381
7382
|
ongoingToolCalls[value.output_index] = void 0;
|
|
@@ -8057,6 +8058,12 @@ function isErrorChunk(chunk) {
|
|
|
8057
8058
|
function isResponseOutputChunk(chunk) {
|
|
8058
8059
|
return !(chunk.type === "response.created" || chunk.type === "response.failed" || chunk.type === "error" || chunk.type === "unknown_chunk");
|
|
8059
8060
|
}
|
|
8061
|
+
function mapWebSearchResult({
|
|
8062
|
+
action,
|
|
8063
|
+
status
|
|
8064
|
+
}) {
|
|
8065
|
+
return status === "completed" ? { result: mapWebSearchOutput(action) } : { isError: true, result: { status } };
|
|
8066
|
+
}
|
|
8060
8067
|
function mapWebSearchOutput(action) {
|
|
8061
8068
|
var _a2;
|
|
8062
8069
|
if (action == null) {
|
|
@@ -8252,7 +8259,12 @@ var openaiTranscriptionResponseSchema = lazySchema25(
|
|
|
8252
8259
|
compression_ratio: z25.number(),
|
|
8253
8260
|
no_speech_prob: z25.number()
|
|
8254
8261
|
})
|
|
8255
|
-
).nullish()
|
|
8262
|
+
).nullish(),
|
|
8263
|
+
// Lenient: an unexpected usage shape must not fail the transcription.
|
|
8264
|
+
usage: z25.object({
|
|
8265
|
+
type: z25.string().nullish(),
|
|
8266
|
+
seconds: z25.number().nullish()
|
|
8267
|
+
}).nullish().catch(void 0)
|
|
8256
8268
|
})
|
|
8257
8269
|
)
|
|
8258
8270
|
);
|
|
@@ -8388,10 +8400,10 @@ var OpenAITranscriptionModel = class {
|
|
|
8388
8400
|
prompt: openAIOptions.prompt,
|
|
8389
8401
|
// https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
|
|
8390
8402
|
// prefer verbose_json to get segments for models that support it
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8403
|
+
// gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
|
|
8404
|
+
response_format: ["gpt-4o-transcribe", "gpt-4o-mini-transcribe"].includes(
|
|
8405
|
+
this.modelId
|
|
8406
|
+
) || this.modelId.startsWith("gpt-4o-mini-transcribe-") || this.modelId === "gpt-transcribe" || this.modelId.startsWith("gpt-transcribe-") ? "json" : "verbose_json",
|
|
8395
8407
|
temperature: openAIOptions.temperature,
|
|
8396
8408
|
timestamp_granularities: openAIOptions.timestampGranularities
|
|
8397
8409
|
};
|
|
@@ -8413,7 +8425,7 @@ var OpenAITranscriptionModel = class {
|
|
|
8413
8425
|
};
|
|
8414
8426
|
}
|
|
8415
8427
|
async doGenerate(options) {
|
|
8416
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
8428
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
8417
8429
|
const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
|
|
8418
8430
|
const { formData, warnings } = await this.getArgs(options);
|
|
8419
8431
|
const {
|
|
@@ -8447,7 +8459,8 @@ var OpenAITranscriptionModel = class {
|
|
|
8447
8459
|
endSecond: word.end
|
|
8448
8460
|
}))) != null ? _g : [],
|
|
8449
8461
|
language,
|
|
8450
|
-
|
|
8462
|
+
// Duration-billed json responses report the duration only in `usage`:
|
|
8463
|
+
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,
|
|
8451
8464
|
warnings,
|
|
8452
8465
|
response: {
|
|
8453
8466
|
timestamp: currentDate,
|
|
@@ -8460,7 +8473,7 @@ var OpenAITranscriptionModel = class {
|
|
|
8460
8473
|
};
|
|
8461
8474
|
|
|
8462
8475
|
// src/version.ts
|
|
8463
|
-
var VERSION = true ? "3.0.
|
|
8476
|
+
var VERSION = true ? "3.0.134" : "0.0.0-test";
|
|
8464
8477
|
|
|
8465
8478
|
// src/openai-provider.ts
|
|
8466
8479
|
function createOpenAI(options = {}) {
|