@ai-sdk/openai 2.0.0-beta.13 → 2.0.0-beta.14
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 +9 -0
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -0
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.js +28 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +28 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -285,12 +285,14 @@ var openaiProviderOptions = z.object({
|
|
|
285
285
|
*/
|
|
286
286
|
structuredOutputs: z.boolean().optional(),
|
|
287
287
|
/**
|
|
288
|
-
* Service tier for the request.
|
|
289
|
-
*
|
|
288
|
+
* Service tier for the request.
|
|
289
|
+
* - 'auto': Default service tier
|
|
290
|
+
* - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
|
|
291
|
+
* - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
|
|
290
292
|
*
|
|
291
293
|
* @default 'auto'
|
|
292
294
|
*/
|
|
293
|
-
serviceTier: z.enum(["auto", "flex"]).optional(),
|
|
295
|
+
serviceTier: z.enum(["auto", "flex", "priority"]).optional(),
|
|
294
296
|
/**
|
|
295
297
|
* Whether to use strict JSON schema validation.
|
|
296
298
|
*
|
|
@@ -668,6 +670,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
668
670
|
});
|
|
669
671
|
baseArgs.service_tier = void 0;
|
|
670
672
|
}
|
|
673
|
+
if (openaiOptions.serviceTier === "priority" && !supportsPriorityProcessing(this.modelId)) {
|
|
674
|
+
warnings.push({
|
|
675
|
+
type: "unsupported-setting",
|
|
676
|
+
setting: "serviceTier",
|
|
677
|
+
details: "priority processing is only available for supported models (GPT-4, o3, o4-mini) and requires Enterprise access"
|
|
678
|
+
});
|
|
679
|
+
baseArgs.service_tier = void 0;
|
|
680
|
+
}
|
|
671
681
|
const {
|
|
672
682
|
tools: openaiTools2,
|
|
673
683
|
toolChoice: openaiToolChoice,
|
|
@@ -1061,6 +1071,9 @@ function isReasoningModel(modelId) {
|
|
|
1061
1071
|
function supportsFlexProcessing(modelId) {
|
|
1062
1072
|
return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
1063
1073
|
}
|
|
1074
|
+
function supportsPriorityProcessing(modelId) {
|
|
1075
|
+
return modelId.startsWith("gpt-4") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
1076
|
+
}
|
|
1064
1077
|
function getSystemMessageMode(modelId) {
|
|
1065
1078
|
var _a, _b;
|
|
1066
1079
|
if (!isReasoningModel(modelId)) {
|
|
@@ -2348,6 +2361,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2348
2361
|
});
|
|
2349
2362
|
delete baseArgs.service_tier;
|
|
2350
2363
|
}
|
|
2364
|
+
if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "priority" && !supportsPriorityProcessing2(this.modelId)) {
|
|
2365
|
+
warnings.push({
|
|
2366
|
+
type: "unsupported-setting",
|
|
2367
|
+
setting: "serviceTier",
|
|
2368
|
+
details: "priority processing is only available for supported models (GPT-4, o3, o4-mini) and requires Enterprise access"
|
|
2369
|
+
});
|
|
2370
|
+
delete baseArgs.service_tier;
|
|
2371
|
+
}
|
|
2351
2372
|
const {
|
|
2352
2373
|
tools: openaiTools2,
|
|
2353
2374
|
toolChoice: openaiToolChoice,
|
|
@@ -3067,6 +3088,9 @@ function getResponsesModelConfig(modelId) {
|
|
|
3067
3088
|
function supportsFlexProcessing2(modelId) {
|
|
3068
3089
|
return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
3069
3090
|
}
|
|
3091
|
+
function supportsPriorityProcessing2(modelId) {
|
|
3092
|
+
return modelId.startsWith("gpt-4") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
3093
|
+
}
|
|
3070
3094
|
var openaiResponsesProviderOptionsSchema = z14.object({
|
|
3071
3095
|
metadata: z14.any().nullish(),
|
|
3072
3096
|
parallelToolCalls: z14.boolean().nullish(),
|
|
@@ -3077,7 +3101,7 @@ var openaiResponsesProviderOptionsSchema = z14.object({
|
|
|
3077
3101
|
strictJsonSchema: z14.boolean().nullish(),
|
|
3078
3102
|
instructions: z14.string().nullish(),
|
|
3079
3103
|
reasoningSummary: z14.string().nullish(),
|
|
3080
|
-
serviceTier: z14.enum(["auto", "flex"]).nullish(),
|
|
3104
|
+
serviceTier: z14.enum(["auto", "flex", "priority"]).nullish(),
|
|
3081
3105
|
include: z14.array(z14.enum(["reasoning.encrypted_content"])).nullish()
|
|
3082
3106
|
});
|
|
3083
3107
|
|