@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/dist/internal/index.d.ts
CHANGED
|
@@ -202,6 +202,10 @@ declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
202
202
|
type OpenAIImageModelEditOptions = InferSchema<typeof openaiImageModelEditOptions>;
|
|
203
203
|
|
|
204
204
|
interface OpenAIImageModelConfig extends OpenAIConfig {
|
|
205
|
+
imageInputCapabilities?: {
|
|
206
|
+
supportsFileInputs: boolean | undefined;
|
|
207
|
+
supportsMaskInputs: boolean | undefined;
|
|
208
|
+
};
|
|
205
209
|
_internal?: {
|
|
206
210
|
currentDate?: () => Date;
|
|
207
211
|
};
|
|
@@ -219,6 +223,8 @@ declare class OpenAIImageModel implements ImageModelV4 {
|
|
|
219
223
|
config: OpenAIImageModelConfig;
|
|
220
224
|
}): OpenAIImageModel;
|
|
221
225
|
get maxImagesPerCall(): number;
|
|
226
|
+
get supportsFileInputs(): boolean | undefined;
|
|
227
|
+
get supportsMaskInputs(): boolean | undefined;
|
|
222
228
|
get provider(): string;
|
|
223
229
|
constructor(modelId: OpenAIImageModelId, config: OpenAIImageModelConfig);
|
|
224
230
|
doGenerate({ prompt, files, mask, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, }: Parameters<ImageModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV4['doGenerate']>>>;
|
|
@@ -690,7 +696,7 @@ type OpenAIResponsesCompactionItem = {
|
|
|
690
696
|
type OpenAIResponsesConfigurationUpdate = {
|
|
691
697
|
type: 'configuration_update';
|
|
692
698
|
reasoning: {
|
|
693
|
-
effort: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
699
|
+
effort: 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
694
700
|
};
|
|
695
701
|
};
|
|
696
702
|
type OpenAIResponsesCompactionTrigger = {
|
package/dist/internal/index.js
CHANGED
|
@@ -2371,6 +2371,32 @@ var OpenAIImageModel = class _OpenAIImageModel {
|
|
|
2371
2371
|
get maxImagesPerCall() {
|
|
2372
2372
|
return getMaxImagesPerCall(this.modelId);
|
|
2373
2373
|
}
|
|
2374
|
+
get supportsFileInputs() {
|
|
2375
|
+
if (this.config.imageInputCapabilities != null) {
|
|
2376
|
+
return this.config.imageInputCapabilities.supportsFileInputs;
|
|
2377
|
+
}
|
|
2378
|
+
if ([
|
|
2379
|
+
"dall-e-2",
|
|
2380
|
+
"gpt-image-1",
|
|
2381
|
+
"gpt-image-1-mini",
|
|
2382
|
+
"gpt-image-1.5",
|
|
2383
|
+
"gpt-image-2",
|
|
2384
|
+
"gpt-image-2.5-flare",
|
|
2385
|
+
"gpt-image-2.5-flare-2026-09-08",
|
|
2386
|
+
"gpt-image-2.5-sunburst",
|
|
2387
|
+
"gpt-image-2.5-sunburst-2026-09-08",
|
|
2388
|
+
"chatgpt-image-latest"
|
|
2389
|
+
].includes(this.modelId)) {
|
|
2390
|
+
return true;
|
|
2391
|
+
}
|
|
2392
|
+
return this.modelId === "dall-e-3" ? false : void 0;
|
|
2393
|
+
}
|
|
2394
|
+
get supportsMaskInputs() {
|
|
2395
|
+
if (this.config.imageInputCapabilities != null) {
|
|
2396
|
+
return this.config.imageInputCapabilities.supportsMaskInputs;
|
|
2397
|
+
}
|
|
2398
|
+
return this.supportsFileInputs;
|
|
2399
|
+
}
|
|
2374
2400
|
get provider() {
|
|
2375
2401
|
return this.config.provider;
|
|
2376
2402
|
}
|
|
@@ -3570,8 +3596,9 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema12(
|
|
|
3570
3596
|
*
|
|
3571
3597
|
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3572
3598
|
* combined with automatic compaction or automatic truncation.
|
|
3599
|
+
* Supported efforts vary by model; 'none' is supported by GPT-6 Sol and Luna.
|
|
3573
3600
|
*/
|
|
3574
|
-
reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3601
|
+
reasoningEffortUpdate: z13.enum(["none", "low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3575
3602
|
/**
|
|
3576
3603
|
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3577
3604
|
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
@@ -3699,7 +3726,7 @@ var openaiResponsesSystemMessageOptionsSchema = lazySchema12(
|
|
|
3699
3726
|
*
|
|
3700
3727
|
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
3701
3728
|
*/
|
|
3702
|
-
reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
3729
|
+
reasoningEffortUpdate: z13.enum(["none", "low", "medium", "high", "xhigh", "max"]).optional()
|
|
3703
3730
|
})
|
|
3704
3731
|
)
|
|
3705
3732
|
);
|
|
@@ -7520,12 +7547,27 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
|
7520
7547
|
outputSchemaToolNames: outputSchemaToolNames.size > 0 ? outputSchemaToolNames : void 0
|
|
7521
7548
|
});
|
|
7522
7549
|
warnings.push(...inputWarnings);
|
|
7550
|
+
const getUpdateEffortUnsupportedReason = (effort) => effort != null && modelCapabilities.supportedReasoningEfforts?.includes(effort) === false ? `${modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}` : void 0;
|
|
7551
|
+
for (const item of input) {
|
|
7552
|
+
if (item.type === "configuration_update") {
|
|
7553
|
+
const unsupportedReason = getUpdateEffortUnsupportedReason(
|
|
7554
|
+
item.reasoning.effort
|
|
7555
|
+
);
|
|
7556
|
+
if (unsupportedReason != null) {
|
|
7557
|
+
throw new UnsupportedFunctionalityError8({
|
|
7558
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
7559
|
+
message: unsupportedReason
|
|
7560
|
+
});
|
|
7561
|
+
}
|
|
7562
|
+
}
|
|
7563
|
+
}
|
|
7523
7564
|
const reasoningEffortUpdate = openaiOptions?.reasoningEffortUpdate;
|
|
7524
|
-
|
|
7565
|
+
const requestUpdateUnsupportedReason = configurationUpdateUnsupportedReason ?? getUpdateEffortUnsupportedReason(reasoningEffortUpdate);
|
|
7566
|
+
if (reasoningEffortUpdate != null && requestUpdateUnsupportedReason != null) {
|
|
7525
7567
|
warnings.push({
|
|
7526
7568
|
type: "unsupported",
|
|
7527
7569
|
feature: "reasoningEffortUpdate",
|
|
7528
|
-
details:
|
|
7570
|
+
details: requestUpdateUnsupportedReason
|
|
7529
7571
|
});
|
|
7530
7572
|
} else if (reasoningEffortUpdate != null) {
|
|
7531
7573
|
const firstItem = input[0];
|