@ai-sdk/openai 2.0.41 → 2.0.43
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 +12 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +102 -3
- package/dist/internal/index.d.ts +102 -3
- package/dist/internal/index.js +15 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -129,7 +129,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
|
|
|
129
129
|
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
type OpenAIImageModelId = '
|
|
132
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | (string & {});
|
|
133
133
|
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
134
134
|
declare const hasDefaultResponseFormat: Set<string>;
|
|
135
135
|
|
|
@@ -203,7 +203,7 @@ declare class OpenAISpeechModel implements SpeechModelV2 {
|
|
|
203
203
|
doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
type OpenAIResponsesModelId = '
|
|
206
|
+
type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
|
|
207
207
|
|
|
208
208
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
209
209
|
readonly specificationVersion = "v2";
|
|
@@ -458,4 +458,103 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithO
|
|
|
458
458
|
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
459
459
|
}>;
|
|
460
460
|
|
|
461
|
-
|
|
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 };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
|
|
|
129
129
|
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
type OpenAIImageModelId = '
|
|
132
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | (string & {});
|
|
133
133
|
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
134
134
|
declare const hasDefaultResponseFormat: Set<string>;
|
|
135
135
|
|
|
@@ -203,7 +203,7 @@ declare class OpenAISpeechModel implements SpeechModelV2 {
|
|
|
203
203
|
doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
type OpenAIResponsesModelId = '
|
|
206
|
+
type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
|
|
207
207
|
|
|
208
208
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
209
209
|
readonly specificationVersion = "v2";
|
|
@@ -458,4 +458,103 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithO
|
|
|
458
458
|
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
459
459
|
}>;
|
|
460
460
|
|
|
461
|
-
|
|
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 };
|
package/dist/internal/index.js
CHANGED
|
@@ -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,
|
|
@@ -1605,9 +1608,13 @@ var import_v48 = require("zod/v4");
|
|
|
1605
1608
|
var modelMaxImagesPerCall = {
|
|
1606
1609
|
"dall-e-3": 1,
|
|
1607
1610
|
"dall-e-2": 10,
|
|
1608
|
-
"gpt-image-1": 10
|
|
1611
|
+
"gpt-image-1": 10,
|
|
1612
|
+
"gpt-image-1-mini": 10
|
|
1609
1613
|
};
|
|
1610
|
-
var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
|
|
1614
|
+
var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
|
|
1615
|
+
"gpt-image-1",
|
|
1616
|
+
"gpt-image-1-mini"
|
|
1617
|
+
]);
|
|
1611
1618
|
|
|
1612
1619
|
// src/image/openai-image-model.ts
|
|
1613
1620
|
var OpenAIImageModel = class {
|
|
@@ -2518,6 +2525,9 @@ var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefin
|
|
|
2518
2525
|
inputSchema: import_v418.z.object({}),
|
|
2519
2526
|
outputSchema: imageGenerationOutputSchema
|
|
2520
2527
|
});
|
|
2528
|
+
var imageGeneration = (args = {}) => {
|
|
2529
|
+
return imageGenerationToolFactory(args);
|
|
2530
|
+
};
|
|
2521
2531
|
|
|
2522
2532
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2523
2533
|
function prepareResponsesTools({
|
|
@@ -4030,6 +4040,9 @@ var openaiResponsesProviderOptionsSchema = import_v419.z.object({
|
|
|
4030
4040
|
fileSearchArgsSchema,
|
|
4031
4041
|
fileSearchOutputSchema,
|
|
4032
4042
|
hasDefaultResponseFormat,
|
|
4043
|
+
imageGeneration,
|
|
4044
|
+
imageGenerationArgsSchema,
|
|
4045
|
+
imageGenerationOutputSchema,
|
|
4033
4046
|
modelMaxImagesPerCall,
|
|
4034
4047
|
openAITranscriptionProviderOptions,
|
|
4035
4048
|
openaiChatLanguageModelOptions,
|