@ai-sdk/openai 2.1.0-beta.10 → 2.1.0-beta.11
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 +11 -0
- package/dist/index.d.mts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +37 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +5 -0
- package/dist/internal/index.d.ts +5 -0
- package/dist/internal/index.js +26 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +26 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0adc679: feat(provider): shared spec v3
|
|
8
|
+
- 2b0caef: feat(provider/openai): preview image generation results
|
|
9
|
+
- Updated dependencies [0adc679]
|
|
10
|
+
- Updated dependencies [2b0caef]
|
|
11
|
+
- @ai-sdk/provider-utils@3.1.0-beta.6
|
|
12
|
+
- @ai-sdk/provider@2.1.0-beta.4
|
|
13
|
+
|
|
3
14
|
## 2.1.0-beta.10
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -182,11 +182,16 @@ declare const openaiTools: {
|
|
|
182
182
|
*
|
|
183
183
|
* Must have name `image_generation`.
|
|
184
184
|
*
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
187
|
-
* @param
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
185
|
+
* @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
|
|
186
|
+
* @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
|
|
187
|
+
* @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
|
|
188
|
+
* @param model - The image generation model to use. Default: gpt-image-1.
|
|
189
|
+
* @param moderation - Moderation level for the generated image. Default: 'auto'.
|
|
190
|
+
* @param outputCompression - Compression level for the output image (0-100).
|
|
191
|
+
* @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
|
|
192
|
+
* @param partialImages - Number of partial images to generate in streaming mode (0-3).
|
|
193
|
+
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
|
|
194
|
+
* @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
|
|
190
195
|
*/
|
|
191
196
|
imageGeneration: (args?: {
|
|
192
197
|
background?: "auto" | "opaque" | "transparent";
|
|
@@ -199,6 +204,7 @@ declare const openaiTools: {
|
|
|
199
204
|
moderation?: "auto";
|
|
200
205
|
outputCompression?: number;
|
|
201
206
|
outputFormat?: "png" | "jpeg" | "webp";
|
|
207
|
+
partialImages?: number;
|
|
202
208
|
quality?: "auto" | "low" | "medium" | "high";
|
|
203
209
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
204
210
|
}) => _ai_sdk_provider_utils.Tool<{}, {
|
package/dist/index.d.ts
CHANGED
|
@@ -182,11 +182,16 @@ declare const openaiTools: {
|
|
|
182
182
|
*
|
|
183
183
|
* Must have name `image_generation`.
|
|
184
184
|
*
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
187
|
-
* @param
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
185
|
+
* @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
|
|
186
|
+
* @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
|
|
187
|
+
* @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
|
|
188
|
+
* @param model - The image generation model to use. Default: gpt-image-1.
|
|
189
|
+
* @param moderation - Moderation level for the generated image. Default: 'auto'.
|
|
190
|
+
* @param outputCompression - Compression level for the output image (0-100).
|
|
191
|
+
* @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
|
|
192
|
+
* @param partialImages - Number of partial images to generate in streaming mode (0-3).
|
|
193
|
+
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
|
|
194
|
+
* @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
|
|
190
195
|
*/
|
|
191
196
|
imageGeneration: (args?: {
|
|
192
197
|
background?: "auto" | "opaque" | "transparent";
|
|
@@ -199,6 +204,7 @@ declare const openaiTools: {
|
|
|
199
204
|
moderation?: "auto";
|
|
200
205
|
outputCompression?: number;
|
|
201
206
|
outputFormat?: "png" | "jpeg" | "webp";
|
|
207
|
+
partialImages?: number;
|
|
202
208
|
quality?: "auto" | "low" | "medium" | "high";
|
|
203
209
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
204
210
|
}) => _ai_sdk_provider_utils.Tool<{}, {
|
package/dist/index.js
CHANGED
|
@@ -1767,6 +1767,7 @@ var imageGenerationArgsSchema = import_v411.z.object({
|
|
|
1767
1767
|
moderation: import_v411.z.enum(["auto"]).optional(),
|
|
1768
1768
|
outputCompression: import_v411.z.number().int().min(0).max(100).optional(),
|
|
1769
1769
|
outputFormat: import_v411.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
1770
|
+
partialImages: import_v411.z.number().int().min(0).max(3).optional(),
|
|
1770
1771
|
quality: import_v411.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1771
1772
|
size: import_v411.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1772
1773
|
}).strict();
|
|
@@ -1938,11 +1939,16 @@ var openaiTools = {
|
|
|
1938
1939
|
*
|
|
1939
1940
|
* Must have name `image_generation`.
|
|
1940
1941
|
*
|
|
1941
|
-
* @param
|
|
1942
|
-
* @param
|
|
1943
|
-
* @param
|
|
1944
|
-
* @param
|
|
1945
|
-
* @param
|
|
1942
|
+
* @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
|
|
1943
|
+
* @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
|
|
1944
|
+
* @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
|
|
1945
|
+
* @param model - The image generation model to use. Default: gpt-image-1.
|
|
1946
|
+
* @param moderation - Moderation level for the generated image. Default: 'auto'.
|
|
1947
|
+
* @param outputCompression - Compression level for the output image (0-100).
|
|
1948
|
+
* @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
|
|
1949
|
+
* @param partialImages - Number of partial images to generate in streaming mode (0-3).
|
|
1950
|
+
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
|
|
1951
|
+
* @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
|
|
1946
1952
|
*/
|
|
1947
1953
|
imageGeneration,
|
|
1948
1954
|
/**
|
|
@@ -2331,11 +2337,12 @@ function prepareResponsesTools({
|
|
|
2331
2337
|
image_url: args.inputImageMask.imageUrl
|
|
2332
2338
|
} : void 0,
|
|
2333
2339
|
model: args.model,
|
|
2334
|
-
size: args.size,
|
|
2335
|
-
quality: args.quality,
|
|
2336
2340
|
moderation: args.moderation,
|
|
2341
|
+
partial_images: args.partialImages,
|
|
2342
|
+
quality: args.quality,
|
|
2343
|
+
output_compression: args.outputCompression,
|
|
2337
2344
|
output_format: args.outputFormat,
|
|
2338
|
-
|
|
2345
|
+
size: args.size
|
|
2339
2346
|
});
|
|
2340
2347
|
break;
|
|
2341
2348
|
}
|
|
@@ -3294,6 +3301,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3294
3301
|
delta: value.delta
|
|
3295
3302
|
});
|
|
3296
3303
|
}
|
|
3304
|
+
} else if (isResponseImageGenerationCallPartialImageChunk(value)) {
|
|
3305
|
+
controller.enqueue({
|
|
3306
|
+
type: "tool-result",
|
|
3307
|
+
toolCallId: value.item_id,
|
|
3308
|
+
toolName: "image_generation",
|
|
3309
|
+
result: {
|
|
3310
|
+
result: value.partial_image_b64
|
|
3311
|
+
},
|
|
3312
|
+
providerExecuted: true,
|
|
3313
|
+
preliminary: true
|
|
3314
|
+
});
|
|
3297
3315
|
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3298
3316
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
3299
3317
|
if (toolCall != null) {
|
|
@@ -3566,6 +3584,12 @@ var responseFunctionCallArgumentsDeltaSchema = import_v416.z.object({
|
|
|
3566
3584
|
output_index: import_v416.z.number(),
|
|
3567
3585
|
delta: import_v416.z.string()
|
|
3568
3586
|
});
|
|
3587
|
+
var responseImageGenerationCallPartialImageSchema = import_v416.z.object({
|
|
3588
|
+
type: import_v416.z.literal("response.image_generation_call.partial_image"),
|
|
3589
|
+
item_id: import_v416.z.string(),
|
|
3590
|
+
output_index: import_v416.z.number(),
|
|
3591
|
+
partial_image_b64: import_v416.z.string()
|
|
3592
|
+
});
|
|
3569
3593
|
var responseCodeInterpreterCallCodeDeltaSchema = import_v416.z.object({
|
|
3570
3594
|
type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
|
|
3571
3595
|
item_id: import_v416.z.string(),
|
|
@@ -3615,6 +3639,7 @@ var openaiResponsesChunkSchema = import_v416.z.union([
|
|
|
3615
3639
|
responseOutputItemAddedSchema,
|
|
3616
3640
|
responseOutputItemDoneSchema,
|
|
3617
3641
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3642
|
+
responseImageGenerationCallPartialImageSchema,
|
|
3618
3643
|
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3619
3644
|
responseCodeInterpreterCallCodeDoneSchema,
|
|
3620
3645
|
responseAnnotationAddedSchema,
|
|
@@ -3642,6 +3667,9 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3642
3667
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3643
3668
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3644
3669
|
}
|
|
3670
|
+
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
3671
|
+
return chunk.type === "response.image_generation_call.partial_image";
|
|
3672
|
+
}
|
|
3645
3673
|
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3646
3674
|
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3647
3675
|
}
|
|
@@ -4074,7 +4102,7 @@ var openaiTranscriptionResponseSchema = import_v419.z.object({
|
|
|
4074
4102
|
});
|
|
4075
4103
|
|
|
4076
4104
|
// src/version.ts
|
|
4077
|
-
var VERSION = true ? "2.1.0-beta.
|
|
4105
|
+
var VERSION = true ? "2.1.0-beta.11" : "0.0.0-test";
|
|
4078
4106
|
|
|
4079
4107
|
// src/openai-provider.ts
|
|
4080
4108
|
function createOpenAI(options = {}) {
|