@ai-sdk/openai 4.0.77 → 4.0.79
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 +26 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +7 -1
- package/dist/internal/index.js +46 -4
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +5 -1
- package/package.json +3 -3
- package/src/image/openai-image-model.ts +37 -0
- package/src/responses/openai-responses-api.ts +1 -1
- package/src/responses/openai-responses-language-model-options.ts +3 -2
- package/src/responses/openai-responses-language-model.ts +28 -2
package/docs/03-openai.mdx
CHANGED
|
@@ -203,13 +203,17 @@ The following provider options are available:
|
|
|
203
203
|
and returns a warning. Use the Responses API for GPT-6 tool calling.
|
|
204
204
|
</Note>
|
|
205
205
|
|
|
206
|
-
- **reasoningEffortUpdate** _'low' | 'medium' | 'high' | 'xhigh' | 'max'_
|
|
206
|
+
- **reasoningEffortUpdate** _'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'_
|
|
207
207
|
Updates the reasoning effort for GPT-6 and later models starting with the
|
|
208
208
|
current response without changing the request-level effort. Use this with
|
|
209
209
|
`previousResponseId` to preserve the original prompt prefix for caching.
|
|
210
210
|
Configuration updates require standard, single-agent mode and cannot be
|
|
211
211
|
combined with automatic compaction or automatic truncation.
|
|
212
212
|
|
|
213
|
+
The SDK checks effort values against the selected model for both request-level
|
|
214
|
+
and message-level updates. For example, GPT-6 Sol and Luna support `none`,
|
|
215
|
+
while GPT-6 Astra does not.
|
|
216
|
+
|
|
213
217
|
- **reasoningMode** _'standard' | 'pro'_
|
|
214
218
|
Controls how much model work GPT-5.6 performs before returning a final answer. `'standard'` is the default. Use `'pro'` for difficult tasks where quality matters more than latency and token usage.
|
|
215
219
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.79",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider": "4.0.
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
38
|
+
"@ai-sdk/provider": "4.0.19",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.50"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ai-sdk/test-server": "2.0.2",
|
|
@@ -28,6 +28,10 @@ import {
|
|
|
28
28
|
type OpenAIImageModelId,
|
|
29
29
|
} from './openai-image-model-options';
|
|
30
30
|
interface OpenAIImageModelConfig extends OpenAIConfig {
|
|
31
|
+
imageInputCapabilities?: {
|
|
32
|
+
supportsFileInputs: boolean | undefined;
|
|
33
|
+
supportsMaskInputs: boolean | undefined;
|
|
34
|
+
};
|
|
31
35
|
_internal?: {
|
|
32
36
|
currentDate?: () => Date;
|
|
33
37
|
};
|
|
@@ -54,6 +58,39 @@ export class OpenAIImageModel implements ImageModelV4 {
|
|
|
54
58
|
return getMaxImagesPerCall(this.modelId);
|
|
55
59
|
}
|
|
56
60
|
|
|
61
|
+
get supportsFileInputs(): boolean | undefined {
|
|
62
|
+
if (this.config.imageInputCapabilities != null) {
|
|
63
|
+
return this.config.imageInputCapabilities.supportsFileInputs;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (
|
|
67
|
+
[
|
|
68
|
+
'dall-e-2',
|
|
69
|
+
'gpt-image-1',
|
|
70
|
+
'gpt-image-1-mini',
|
|
71
|
+
'gpt-image-1.5',
|
|
72
|
+
'gpt-image-2',
|
|
73
|
+
'gpt-image-2.5-flare',
|
|
74
|
+
'gpt-image-2.5-flare-2026-09-08',
|
|
75
|
+
'gpt-image-2.5-sunburst',
|
|
76
|
+
'gpt-image-2.5-sunburst-2026-09-08',
|
|
77
|
+
'chatgpt-image-latest',
|
|
78
|
+
].includes(this.modelId)
|
|
79
|
+
) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return this.modelId === 'dall-e-3' ? false : undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get supportsMaskInputs(): boolean | undefined {
|
|
87
|
+
if (this.config.imageInputCapabilities != null) {
|
|
88
|
+
return this.config.imageInputCapabilities.supportsMaskInputs;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return this.supportsFileInputs;
|
|
92
|
+
}
|
|
93
|
+
|
|
57
94
|
get provider(): string {
|
|
58
95
|
return this.config.provider;
|
|
59
96
|
}
|
|
@@ -486,7 +486,7 @@ export type OpenAIResponsesCompactionItem = {
|
|
|
486
486
|
export type OpenAIResponsesConfigurationUpdate = {
|
|
487
487
|
type: 'configuration_update';
|
|
488
488
|
reasoning: {
|
|
489
|
-
effort: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
489
|
+
effort: 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
492
|
|
|
@@ -284,9 +284,10 @@ export const openaiLanguageModelResponsesOptionsSchema = lazySchema(() =>
|
|
|
284
284
|
*
|
|
285
285
|
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
286
286
|
* combined with automatic compaction or automatic truncation.
|
|
287
|
+
* Supported efforts vary by model; 'none' is supported by GPT-6 Sol and Luna.
|
|
287
288
|
*/
|
|
288
289
|
reasoningEffortUpdate: z
|
|
289
|
-
.enum(['low', 'medium', 'high', 'xhigh', 'max'])
|
|
290
|
+
.enum(['none', 'low', 'medium', 'high', 'xhigh', 'max'])
|
|
290
291
|
.optional(),
|
|
291
292
|
|
|
292
293
|
/**
|
|
@@ -445,7 +446,7 @@ export const openaiResponsesSystemMessageOptionsSchema = lazySchema(() =>
|
|
|
445
446
|
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
446
447
|
*/
|
|
447
448
|
reasoningEffortUpdate: z
|
|
448
|
-
.enum(['low', 'medium', 'high', 'xhigh', 'max'])
|
|
449
|
+
.enum(['none', 'low', 'medium', 'high', 'xhigh', 'max'])
|
|
449
450
|
.optional(),
|
|
450
451
|
}),
|
|
451
452
|
),
|
|
@@ -451,15 +451,41 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
451
451
|
|
|
452
452
|
warnings.push(...inputWarnings);
|
|
453
453
|
|
|
454
|
+
// The schema accepts update efforts supported by any supported model. Check
|
|
455
|
+
// whether this specific model supports the requested effort.
|
|
456
|
+
const getUpdateEffortUnsupportedReason = (effort: string | undefined) =>
|
|
457
|
+
effort != null &&
|
|
458
|
+
modelCapabilities.supportedReasoningEfforts?.includes(effort) === false
|
|
459
|
+
? `${modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(', ')}`
|
|
460
|
+
: undefined;
|
|
461
|
+
|
|
462
|
+
// Reject configuration updates whose effort value is unsupported by the selected model.
|
|
463
|
+
for (const item of input) {
|
|
464
|
+
if (item.type === 'configuration_update') {
|
|
465
|
+
const unsupportedReason = getUpdateEffortUnsupportedReason(
|
|
466
|
+
item.reasoning.effort,
|
|
467
|
+
);
|
|
468
|
+
if (unsupportedReason != null) {
|
|
469
|
+
throw new UnsupportedFunctionalityError({
|
|
470
|
+
functionality: 'Message-level reasoningEffortUpdate',
|
|
471
|
+
message: unsupportedReason,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
454
477
|
const reasoningEffortUpdate = openaiOptions?.reasoningEffortUpdate;
|
|
478
|
+
const requestUpdateUnsupportedReason =
|
|
479
|
+
configurationUpdateUnsupportedReason ??
|
|
480
|
+
getUpdateEffortUnsupportedReason(reasoningEffortUpdate);
|
|
455
481
|
if (
|
|
456
482
|
reasoningEffortUpdate != null &&
|
|
457
|
-
|
|
483
|
+
requestUpdateUnsupportedReason != null
|
|
458
484
|
) {
|
|
459
485
|
warnings.push({
|
|
460
486
|
type: 'unsupported',
|
|
461
487
|
feature: 'reasoningEffortUpdate',
|
|
462
|
-
details:
|
|
488
|
+
details: requestUpdateUnsupportedReason,
|
|
463
489
|
});
|
|
464
490
|
} else if (reasoningEffortUpdate != null) {
|
|
465
491
|
const firstItem = input[0];
|