@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/dist/index.mjs
CHANGED
|
@@ -1778,6 +1778,7 @@ var imageGenerationArgsSchema = z11.object({
|
|
|
1778
1778
|
moderation: z11.enum(["auto"]).optional(),
|
|
1779
1779
|
outputCompression: z11.number().int().min(0).max(100).optional(),
|
|
1780
1780
|
outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
|
|
1781
|
+
partialImages: z11.number().int().min(0).max(3).optional(),
|
|
1781
1782
|
quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1782
1783
|
size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1783
1784
|
}).strict();
|
|
@@ -1949,11 +1950,16 @@ var openaiTools = {
|
|
|
1949
1950
|
*
|
|
1950
1951
|
* Must have name `image_generation`.
|
|
1951
1952
|
*
|
|
1952
|
-
* @param
|
|
1953
|
-
* @param
|
|
1954
|
-
* @param
|
|
1955
|
-
* @param
|
|
1956
|
-
* @param
|
|
1953
|
+
* @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
|
|
1954
|
+
* @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
|
|
1955
|
+
* @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
|
|
1956
|
+
* @param model - The image generation model to use. Default: gpt-image-1.
|
|
1957
|
+
* @param moderation - Moderation level for the generated image. Default: 'auto'.
|
|
1958
|
+
* @param outputCompression - Compression level for the output image (0-100).
|
|
1959
|
+
* @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
|
|
1960
|
+
* @param partialImages - Number of partial images to generate in streaming mode (0-3).
|
|
1961
|
+
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
|
|
1962
|
+
* @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
|
|
1957
1963
|
*/
|
|
1958
1964
|
imageGeneration,
|
|
1959
1965
|
/**
|
|
@@ -2355,11 +2361,12 @@ function prepareResponsesTools({
|
|
|
2355
2361
|
image_url: args.inputImageMask.imageUrl
|
|
2356
2362
|
} : void 0,
|
|
2357
2363
|
model: args.model,
|
|
2358
|
-
size: args.size,
|
|
2359
|
-
quality: args.quality,
|
|
2360
2364
|
moderation: args.moderation,
|
|
2365
|
+
partial_images: args.partialImages,
|
|
2366
|
+
quality: args.quality,
|
|
2367
|
+
output_compression: args.outputCompression,
|
|
2361
2368
|
output_format: args.outputFormat,
|
|
2362
|
-
|
|
2369
|
+
size: args.size
|
|
2363
2370
|
});
|
|
2364
2371
|
break;
|
|
2365
2372
|
}
|
|
@@ -3318,6 +3325,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3318
3325
|
delta: value.delta
|
|
3319
3326
|
});
|
|
3320
3327
|
}
|
|
3328
|
+
} else if (isResponseImageGenerationCallPartialImageChunk(value)) {
|
|
3329
|
+
controller.enqueue({
|
|
3330
|
+
type: "tool-result",
|
|
3331
|
+
toolCallId: value.item_id,
|
|
3332
|
+
toolName: "image_generation",
|
|
3333
|
+
result: {
|
|
3334
|
+
result: value.partial_image_b64
|
|
3335
|
+
},
|
|
3336
|
+
providerExecuted: true,
|
|
3337
|
+
preliminary: true
|
|
3338
|
+
});
|
|
3321
3339
|
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3322
3340
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
3323
3341
|
if (toolCall != null) {
|
|
@@ -3590,6 +3608,12 @@ var responseFunctionCallArgumentsDeltaSchema = z16.object({
|
|
|
3590
3608
|
output_index: z16.number(),
|
|
3591
3609
|
delta: z16.string()
|
|
3592
3610
|
});
|
|
3611
|
+
var responseImageGenerationCallPartialImageSchema = z16.object({
|
|
3612
|
+
type: z16.literal("response.image_generation_call.partial_image"),
|
|
3613
|
+
item_id: z16.string(),
|
|
3614
|
+
output_index: z16.number(),
|
|
3615
|
+
partial_image_b64: z16.string()
|
|
3616
|
+
});
|
|
3593
3617
|
var responseCodeInterpreterCallCodeDeltaSchema = z16.object({
|
|
3594
3618
|
type: z16.literal("response.code_interpreter_call_code.delta"),
|
|
3595
3619
|
item_id: z16.string(),
|
|
@@ -3639,6 +3663,7 @@ var openaiResponsesChunkSchema = z16.union([
|
|
|
3639
3663
|
responseOutputItemAddedSchema,
|
|
3640
3664
|
responseOutputItemDoneSchema,
|
|
3641
3665
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3666
|
+
responseImageGenerationCallPartialImageSchema,
|
|
3642
3667
|
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3643
3668
|
responseCodeInterpreterCallCodeDoneSchema,
|
|
3644
3669
|
responseAnnotationAddedSchema,
|
|
@@ -3666,6 +3691,9 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3666
3691
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3667
3692
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3668
3693
|
}
|
|
3694
|
+
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
3695
|
+
return chunk.type === "response.image_generation_call.partial_image";
|
|
3696
|
+
}
|
|
3669
3697
|
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3670
3698
|
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3671
3699
|
}
|
|
@@ -4110,7 +4138,7 @@ var openaiTranscriptionResponseSchema = z19.object({
|
|
|
4110
4138
|
});
|
|
4111
4139
|
|
|
4112
4140
|
// src/version.ts
|
|
4113
|
-
var VERSION = true ? "2.1.0-beta.
|
|
4141
|
+
var VERSION = true ? "2.1.0-beta.11" : "0.0.0-test";
|
|
4114
4142
|
|
|
4115
4143
|
// src/openai-provider.ts
|
|
4116
4144
|
function createOpenAI(options = {}) {
|