@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.
@@ -482,6 +482,7 @@ declare const imageGenerationArgsSchema: z.ZodObject<{
482
482
  jpeg: "jpeg";
483
483
  webp: "webp";
484
484
  }>>;
485
+ partialImages: z.ZodOptional<z.ZodNumber>;
485
486
  quality: z.ZodOptional<z.ZodEnum<{
486
487
  low: "low";
487
488
  medium: "medium";
@@ -538,6 +539,10 @@ type ImageGenerationArgs = {
538
539
  * Default: png
539
540
  */
540
541
  outputFormat?: 'png' | 'jpeg' | 'webp';
542
+ /**
543
+ * Number of partial images to generate in streaming mode, from 0 (default value) to 3.
544
+ */
545
+ partialImages?: number;
541
546
  /**
542
547
  * The quality of the generated image.
543
548
  * One of low, medium, high, or auto. Default: auto.
@@ -482,6 +482,7 @@ declare const imageGenerationArgsSchema: z.ZodObject<{
482
482
  jpeg: "jpeg";
483
483
  webp: "webp";
484
484
  }>>;
485
+ partialImages: z.ZodOptional<z.ZodNumber>;
485
486
  quality: z.ZodOptional<z.ZodEnum<{
486
487
  low: "low";
487
488
  medium: "medium";
@@ -538,6 +539,10 @@ type ImageGenerationArgs = {
538
539
  * Default: png
539
540
  */
540
541
  outputFormat?: 'png' | 'jpeg' | 'webp';
542
+ /**
543
+ * Number of partial images to generate in streaming mode, from 0 (default value) to 3.
544
+ */
545
+ partialImages?: number;
541
546
  /**
542
547
  * The quality of the generated image.
543
548
  * One of low, medium, high, or auto. Default: auto.
@@ -2509,6 +2509,7 @@ var imageGenerationArgsSchema = import_v418.z.object({
2509
2509
  moderation: import_v418.z.enum(["auto"]).optional(),
2510
2510
  outputCompression: import_v418.z.number().int().min(0).max(100).optional(),
2511
2511
  outputFormat: import_v418.z.enum(["png", "jpeg", "webp"]).optional(),
2512
+ partialImages: import_v418.z.number().int().min(0).max(3).optional(),
2512
2513
  quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
2513
2514
  size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2514
2515
  }).strict();
@@ -2608,11 +2609,12 @@ function prepareResponsesTools({
2608
2609
  image_url: args.inputImageMask.imageUrl
2609
2610
  } : void 0,
2610
2611
  model: args.model,
2611
- size: args.size,
2612
- quality: args.quality,
2613
2612
  moderation: args.moderation,
2613
+ partial_images: args.partialImages,
2614
+ quality: args.quality,
2615
+ output_compression: args.outputCompression,
2614
2616
  output_format: args.outputFormat,
2615
- output_compression: args.outputCompression
2617
+ size: args.size
2616
2618
  });
2617
2619
  break;
2618
2620
  }
@@ -3571,6 +3573,17 @@ var OpenAIResponsesLanguageModel = class {
3571
3573
  delta: value.delta
3572
3574
  });
3573
3575
  }
3576
+ } else if (isResponseImageGenerationCallPartialImageChunk(value)) {
3577
+ controller.enqueue({
3578
+ type: "tool-result",
3579
+ toolCallId: value.item_id,
3580
+ toolName: "image_generation",
3581
+ result: {
3582
+ result: value.partial_image_b64
3583
+ },
3584
+ providerExecuted: true,
3585
+ preliminary: true
3586
+ });
3574
3587
  } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3575
3588
  const toolCall = ongoingToolCalls[value.output_index];
3576
3589
  if (toolCall != null) {
@@ -3843,6 +3856,12 @@ var responseFunctionCallArgumentsDeltaSchema = import_v419.z.object({
3843
3856
  output_index: import_v419.z.number(),
3844
3857
  delta: import_v419.z.string()
3845
3858
  });
3859
+ var responseImageGenerationCallPartialImageSchema = import_v419.z.object({
3860
+ type: import_v419.z.literal("response.image_generation_call.partial_image"),
3861
+ item_id: import_v419.z.string(),
3862
+ output_index: import_v419.z.number(),
3863
+ partial_image_b64: import_v419.z.string()
3864
+ });
3846
3865
  var responseCodeInterpreterCallCodeDeltaSchema = import_v419.z.object({
3847
3866
  type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
3848
3867
  item_id: import_v419.z.string(),
@@ -3892,6 +3911,7 @@ var openaiResponsesChunkSchema = import_v419.z.union([
3892
3911
  responseOutputItemAddedSchema,
3893
3912
  responseOutputItemDoneSchema,
3894
3913
  responseFunctionCallArgumentsDeltaSchema,
3914
+ responseImageGenerationCallPartialImageSchema,
3895
3915
  responseCodeInterpreterCallCodeDeltaSchema,
3896
3916
  responseCodeInterpreterCallCodeDoneSchema,
3897
3917
  responseAnnotationAddedSchema,
@@ -3919,6 +3939,9 @@ function isResponseCreatedChunk(chunk) {
3919
3939
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3920
3940
  return chunk.type === "response.function_call_arguments.delta";
3921
3941
  }
3942
+ function isResponseImageGenerationCallPartialImageChunk(chunk) {
3943
+ return chunk.type === "response.image_generation_call.partial_image";
3944
+ }
3922
3945
  function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3923
3946
  return chunk.type === "response.code_interpreter_call_code.delta";
3924
3947
  }