@ai-sdk/openai 2.0.41 → 2.0.42

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.42
4
+
5
+ ### Patch Changes
6
+
7
+ - 2a5edd3: enables image_generation capabilities in the Azure provider through the Responses API.
8
+
3
9
  ## 2.0.41
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -4074,7 +4074,7 @@ var openaiTranscriptionResponseSchema = import_v419.z.object({
4074
4074
  });
4075
4075
 
4076
4076
  // src/version.ts
4077
- var VERSION = true ? "2.0.41" : "0.0.0-test";
4077
+ var VERSION = true ? "2.0.42" : "0.0.0-test";
4078
4078
 
4079
4079
  // src/openai-provider.ts
4080
4080
  function createOpenAI(options = {}) {
package/dist/index.mjs CHANGED
@@ -4110,7 +4110,7 @@ var openaiTranscriptionResponseSchema = z19.object({
4110
4110
  });
4111
4111
 
4112
4112
  // src/version.ts
4113
- var VERSION = true ? "2.0.41" : "0.0.0-test";
4113
+ var VERSION = true ? "2.0.42" : "0.0.0-test";
4114
4114
 
4115
4115
  // src/openai-provider.ts
4116
4116
  function createOpenAI(options = {}) {
@@ -458,4 +458,103 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithO
458
458
  filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
459
459
  }>;
460
460
 
461
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
461
+ declare const imageGenerationArgsSchema: z.ZodObject<{
462
+ background: z.ZodOptional<z.ZodEnum<{
463
+ auto: "auto";
464
+ opaque: "opaque";
465
+ transparent: "transparent";
466
+ }>>;
467
+ inputFidelity: z.ZodOptional<z.ZodEnum<{
468
+ low: "low";
469
+ high: "high";
470
+ }>>;
471
+ inputImageMask: z.ZodOptional<z.ZodObject<{
472
+ fileId: z.ZodOptional<z.ZodString>;
473
+ imageUrl: z.ZodOptional<z.ZodString>;
474
+ }, z.core.$strip>>;
475
+ model: z.ZodOptional<z.ZodString>;
476
+ moderation: z.ZodOptional<z.ZodEnum<{
477
+ auto: "auto";
478
+ }>>;
479
+ outputCompression: z.ZodOptional<z.ZodNumber>;
480
+ outputFormat: z.ZodOptional<z.ZodEnum<{
481
+ png: "png";
482
+ jpeg: "jpeg";
483
+ webp: "webp";
484
+ }>>;
485
+ quality: z.ZodOptional<z.ZodEnum<{
486
+ low: "low";
487
+ medium: "medium";
488
+ high: "high";
489
+ auto: "auto";
490
+ }>>;
491
+ size: z.ZodOptional<z.ZodEnum<{
492
+ auto: "auto";
493
+ "1024x1024": "1024x1024";
494
+ "1024x1536": "1024x1536";
495
+ "1536x1024": "1536x1024";
496
+ }>>;
497
+ }, z.core.$strict>;
498
+ declare const imageGenerationOutputSchema: z.ZodObject<{
499
+ result: z.ZodString;
500
+ }, z.core.$strip>;
501
+ type ImageGenerationArgs = {
502
+ /**
503
+ * Background type for the generated image. Default is 'auto'.
504
+ */
505
+ background?: 'auto' | 'opaque' | 'transparent';
506
+ /**
507
+ * Input fidelity for the generated image. Default is 'low'.
508
+ */
509
+ inputFidelity?: 'low' | 'high';
510
+ /**
511
+ * Optional mask for inpainting.
512
+ * Contains image_url (string, optional) and file_id (string, optional).
513
+ */
514
+ inputImageMask?: {
515
+ /**
516
+ * File ID for the mask image.
517
+ */
518
+ fileId?: string;
519
+ /**
520
+ * Base64-encoded mask image.
521
+ */
522
+ imageUrl?: string;
523
+ };
524
+ /**
525
+ * The image generation model to use. Default: gpt-image-1.
526
+ */
527
+ model?: string;
528
+ /**
529
+ * Moderation level for the generated image. Default: auto.
530
+ */
531
+ moderation?: 'auto';
532
+ /**
533
+ * Compression level for the output image. Default: 100.
534
+ */
535
+ outputCompression?: number;
536
+ /**
537
+ * The output format of the generated image. One of png, webp, or jpeg.
538
+ * Default: png
539
+ */
540
+ outputFormat?: 'png' | 'jpeg' | 'webp';
541
+ /**
542
+ * The quality of the generated image.
543
+ * One of low, medium, high, or auto. Default: auto.
544
+ */
545
+ quality?: 'auto' | 'low' | 'medium' | 'high';
546
+ /**
547
+ * The size of the generated image.
548
+ * One of 1024x1024, 1024x1536, 1536x1024, or auto.
549
+ * Default: auto.
550
+ */
551
+ size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
552
+ };
553
+ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.Tool<{}, {
554
+ /**
555
+ * The generated image encoded in base64.
556
+ */
557
+ result: string;
558
+ }>;
559
+
560
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
@@ -458,4 +458,103 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithO
458
458
  filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
459
459
  }>;
460
460
 
461
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
461
+ declare const imageGenerationArgsSchema: z.ZodObject<{
462
+ background: z.ZodOptional<z.ZodEnum<{
463
+ auto: "auto";
464
+ opaque: "opaque";
465
+ transparent: "transparent";
466
+ }>>;
467
+ inputFidelity: z.ZodOptional<z.ZodEnum<{
468
+ low: "low";
469
+ high: "high";
470
+ }>>;
471
+ inputImageMask: z.ZodOptional<z.ZodObject<{
472
+ fileId: z.ZodOptional<z.ZodString>;
473
+ imageUrl: z.ZodOptional<z.ZodString>;
474
+ }, z.core.$strip>>;
475
+ model: z.ZodOptional<z.ZodString>;
476
+ moderation: z.ZodOptional<z.ZodEnum<{
477
+ auto: "auto";
478
+ }>>;
479
+ outputCompression: z.ZodOptional<z.ZodNumber>;
480
+ outputFormat: z.ZodOptional<z.ZodEnum<{
481
+ png: "png";
482
+ jpeg: "jpeg";
483
+ webp: "webp";
484
+ }>>;
485
+ quality: z.ZodOptional<z.ZodEnum<{
486
+ low: "low";
487
+ medium: "medium";
488
+ high: "high";
489
+ auto: "auto";
490
+ }>>;
491
+ size: z.ZodOptional<z.ZodEnum<{
492
+ auto: "auto";
493
+ "1024x1024": "1024x1024";
494
+ "1024x1536": "1024x1536";
495
+ "1536x1024": "1536x1024";
496
+ }>>;
497
+ }, z.core.$strict>;
498
+ declare const imageGenerationOutputSchema: z.ZodObject<{
499
+ result: z.ZodString;
500
+ }, z.core.$strip>;
501
+ type ImageGenerationArgs = {
502
+ /**
503
+ * Background type for the generated image. Default is 'auto'.
504
+ */
505
+ background?: 'auto' | 'opaque' | 'transparent';
506
+ /**
507
+ * Input fidelity for the generated image. Default is 'low'.
508
+ */
509
+ inputFidelity?: 'low' | 'high';
510
+ /**
511
+ * Optional mask for inpainting.
512
+ * Contains image_url (string, optional) and file_id (string, optional).
513
+ */
514
+ inputImageMask?: {
515
+ /**
516
+ * File ID for the mask image.
517
+ */
518
+ fileId?: string;
519
+ /**
520
+ * Base64-encoded mask image.
521
+ */
522
+ imageUrl?: string;
523
+ };
524
+ /**
525
+ * The image generation model to use. Default: gpt-image-1.
526
+ */
527
+ model?: string;
528
+ /**
529
+ * Moderation level for the generated image. Default: auto.
530
+ */
531
+ moderation?: 'auto';
532
+ /**
533
+ * Compression level for the output image. Default: 100.
534
+ */
535
+ outputCompression?: number;
536
+ /**
537
+ * The output format of the generated image. One of png, webp, or jpeg.
538
+ * Default: png
539
+ */
540
+ outputFormat?: 'png' | 'jpeg' | 'webp';
541
+ /**
542
+ * The quality of the generated image.
543
+ * One of low, medium, high, or auto. Default: auto.
544
+ */
545
+ quality?: 'auto' | 'low' | 'medium' | 'high';
546
+ /**
547
+ * The size of the generated image.
548
+ * One of 1024x1024, 1024x1536, 1536x1024, or auto.
549
+ * Default: auto.
550
+ */
551
+ size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
552
+ };
553
+ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.Tool<{}, {
554
+ /**
555
+ * The generated image encoded in base64.
556
+ */
557
+ result: string;
558
+ }>;
559
+
560
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
@@ -36,6 +36,9 @@ __export(internal_exports, {
36
36
  fileSearchArgsSchema: () => fileSearchArgsSchema,
37
37
  fileSearchOutputSchema: () => fileSearchOutputSchema,
38
38
  hasDefaultResponseFormat: () => hasDefaultResponseFormat,
39
+ imageGeneration: () => imageGeneration,
40
+ imageGenerationArgsSchema: () => imageGenerationArgsSchema,
41
+ imageGenerationOutputSchema: () => imageGenerationOutputSchema,
39
42
  modelMaxImagesPerCall: () => modelMaxImagesPerCall,
40
43
  openAITranscriptionProviderOptions: () => openAITranscriptionProviderOptions,
41
44
  openaiChatLanguageModelOptions: () => openaiChatLanguageModelOptions,
@@ -2518,6 +2521,9 @@ var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefin
2518
2521
  inputSchema: import_v418.z.object({}),
2519
2522
  outputSchema: imageGenerationOutputSchema
2520
2523
  });
2524
+ var imageGeneration = (args = {}) => {
2525
+ return imageGenerationToolFactory(args);
2526
+ };
2521
2527
 
2522
2528
  // src/responses/openai-responses-prepare-tools.ts
2523
2529
  function prepareResponsesTools({
@@ -4030,6 +4036,9 @@ var openaiResponsesProviderOptionsSchema = import_v419.z.object({
4030
4036
  fileSearchArgsSchema,
4031
4037
  fileSearchOutputSchema,
4032
4038
  hasDefaultResponseFormat,
4039
+ imageGeneration,
4040
+ imageGenerationArgsSchema,
4041
+ imageGenerationOutputSchema,
4033
4042
  modelMaxImagesPerCall,
4034
4043
  openAITranscriptionProviderOptions,
4035
4044
  openaiChatLanguageModelOptions,