@ai-sdk/openai 3.0.109 → 3.0.111
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 +14 -0
- package/dist/index.d.mts +40 -21
- package/dist/index.d.ts +40 -21
- package/dist/index.js +84 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -22
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +30 -10
- package/dist/internal/index.d.ts +30 -10
- package/dist/internal/index.js +81 -20
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +81 -20
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +94 -13
- package/package.json +1 -1
- package/src/image/openai-image-model-options.ts +11 -2
- package/src/index.ts +2 -0
- package/src/openai-config.ts +5 -0
- package/src/openai-language-model-capabilities.ts +2 -0
- package/src/openai-tools.ts +2 -1
- package/src/responses/convert-to-openai-responses-input.ts +20 -0
- package/src/responses/openai-responses-api.ts +14 -1
- package/src/responses/openai-responses-language-model.ts +23 -4
- package/src/responses/openai-responses-prepare-tools.ts +48 -1
- package/src/responses/openai-responses-provider-metadata.ts +10 -0
- package/src/tool/custom.ts +7 -0
- package/src/tool/image-generation.ts +10 -5
|
@@ -92,6 +92,11 @@ type OpenAIConfig = {
|
|
|
92
92
|
headers: () => Record<string, string | undefined>;
|
|
93
93
|
fetch?: FetchFunction;
|
|
94
94
|
generateId?: () => string;
|
|
95
|
+
/**
|
|
96
|
+
* Whether Responses API message input items must include an explicit
|
|
97
|
+
* `type: 'message'` discriminator.
|
|
98
|
+
*/
|
|
99
|
+
explicitMessageItemType?: boolean;
|
|
95
100
|
/**
|
|
96
101
|
* File ID prefixes used to identify file IDs in Responses API.
|
|
97
102
|
* When undefined, all file data is treated as base64 content.
|
|
@@ -122,12 +127,12 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3 {
|
|
|
122
127
|
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'chatgpt-image-latest' | (string & {});
|
|
130
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
126
131
|
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
127
132
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
128
133
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
129
134
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
130
|
-
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
135
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
131
136
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
132
137
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
133
138
|
outputCompression?: number | undefined;
|
|
@@ -135,7 +140,7 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
135
140
|
}>;
|
|
136
141
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
137
142
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
138
|
-
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
143
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
139
144
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
140
145
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
141
146
|
outputCompression?: number | undefined;
|
|
@@ -145,7 +150,7 @@ declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySche
|
|
|
145
150
|
}>;
|
|
146
151
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
147
152
|
declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
148
|
-
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
153
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
149
154
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
150
155
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
151
156
|
outputCompression?: number | undefined;
|
|
@@ -389,6 +394,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
389
394
|
call_id: string;
|
|
390
395
|
name: string;
|
|
391
396
|
arguments: string;
|
|
397
|
+
async?: boolean | null | undefined;
|
|
392
398
|
namespace?: string | null | undefined;
|
|
393
399
|
} | {
|
|
394
400
|
type: "web_search_call";
|
|
@@ -451,6 +457,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
451
457
|
call_id: string;
|
|
452
458
|
name: string;
|
|
453
459
|
input: string;
|
|
460
|
+
async?: boolean | null | undefined;
|
|
454
461
|
} | {
|
|
455
462
|
type: "shell_call";
|
|
456
463
|
id: string;
|
|
@@ -519,6 +526,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
519
526
|
name: string;
|
|
520
527
|
arguments: string;
|
|
521
528
|
status: "completed";
|
|
529
|
+
async?: boolean | null | undefined;
|
|
522
530
|
namespace?: string | null | undefined;
|
|
523
531
|
} | {
|
|
524
532
|
type: "custom_tool_call";
|
|
@@ -527,6 +535,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
527
535
|
name: string;
|
|
528
536
|
input: string;
|
|
529
537
|
status: "completed";
|
|
538
|
+
async?: boolean | null | undefined;
|
|
530
539
|
} | {
|
|
531
540
|
type: "code_interpreter_call";
|
|
532
541
|
id: string;
|
|
@@ -779,6 +788,14 @@ type OpenaiResponsesReasoningProviderMetadata = {
|
|
|
779
788
|
type OpenaiResponsesProviderMetadata = {
|
|
780
789
|
openai: ResponsesProviderMetadata;
|
|
781
790
|
};
|
|
791
|
+
type ResponsesToolCallProviderMetadata = {
|
|
792
|
+
itemId: string;
|
|
793
|
+
async?: boolean;
|
|
794
|
+
namespace?: string;
|
|
795
|
+
};
|
|
796
|
+
type OpenaiResponsesToolCallProviderMetadata = {
|
|
797
|
+
openai: ResponsesToolCallProviderMetadata;
|
|
798
|
+
};
|
|
782
799
|
type ResponsesTextProviderMetadata = {
|
|
783
800
|
itemId: string;
|
|
784
801
|
phase?: 'commentary' | 'final_answer' | null;
|
|
@@ -1109,7 +1126,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
1109
1126
|
outputCompression?: number | undefined;
|
|
1110
1127
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
1111
1128
|
partialImages?: number | undefined;
|
|
1112
|
-
quality?: "low" | "medium" | "high" | "auto" | undefined;
|
|
1129
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | undefined;
|
|
1113
1130
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
|
|
1114
1131
|
}>;
|
|
1115
1132
|
declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
@@ -1161,15 +1178,18 @@ type ImageGenerationArgs = {
|
|
|
1161
1178
|
partialImages?: number;
|
|
1162
1179
|
/**
|
|
1163
1180
|
* The quality of the generated image.
|
|
1164
|
-
* One of low, medium, high, or auto. Default: auto.
|
|
1181
|
+
* One of low, medium, high, xhigh, max, or auto. Default: auto.
|
|
1182
|
+
* xhigh and max are supported by GPT Image 2.5 models.
|
|
1165
1183
|
*/
|
|
1166
|
-
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
1184
|
+
quality?: 'auto' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
1167
1185
|
/**
|
|
1168
1186
|
* The size of the generated image.
|
|
1169
|
-
* One of 1024x1024, 1024x1536, 1536x1024, or auto.
|
|
1187
|
+
* One of 1024x1024, 1024x1536, 1536x1024, or auto. GPT Image 2 and 2.5
|
|
1188
|
+
* models also accept arbitrary WIDTHxHEIGHT sizes where both are divisible
|
|
1189
|
+
* by 16, e.g. 1536x864.
|
|
1170
1190
|
* Default: auto.
|
|
1171
1191
|
*/
|
|
1172
|
-
size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
|
|
1192
|
+
size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | (string & {});
|
|
1173
1193
|
};
|
|
1174
1194
|
declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.Tool<{}, {
|
|
1175
1195
|
/**
|
|
@@ -1463,4 +1483,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
|
|
|
1463
1483
|
};
|
|
1464
1484
|
}>;
|
|
1465
1485
|
|
|
1466
|
-
export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
|
|
1486
|
+
export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -92,6 +92,11 @@ type OpenAIConfig = {
|
|
|
92
92
|
headers: () => Record<string, string | undefined>;
|
|
93
93
|
fetch?: FetchFunction;
|
|
94
94
|
generateId?: () => string;
|
|
95
|
+
/**
|
|
96
|
+
* Whether Responses API message input items must include an explicit
|
|
97
|
+
* `type: 'message'` discriminator.
|
|
98
|
+
*/
|
|
99
|
+
explicitMessageItemType?: boolean;
|
|
95
100
|
/**
|
|
96
101
|
* File ID prefixes used to identify file IDs in Responses API.
|
|
97
102
|
* When undefined, all file data is treated as base64 content.
|
|
@@ -122,12 +127,12 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3 {
|
|
|
122
127
|
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'chatgpt-image-latest' | (string & {});
|
|
130
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
126
131
|
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
127
132
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
128
133
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
129
134
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
130
|
-
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
135
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
131
136
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
132
137
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
133
138
|
outputCompression?: number | undefined;
|
|
@@ -135,7 +140,7 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
135
140
|
}>;
|
|
136
141
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
137
142
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
138
|
-
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
143
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
139
144
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
140
145
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
141
146
|
outputCompression?: number | undefined;
|
|
@@ -145,7 +150,7 @@ declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySche
|
|
|
145
150
|
}>;
|
|
146
151
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
147
152
|
declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
148
|
-
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
153
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
149
154
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
150
155
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
151
156
|
outputCompression?: number | undefined;
|
|
@@ -389,6 +394,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
389
394
|
call_id: string;
|
|
390
395
|
name: string;
|
|
391
396
|
arguments: string;
|
|
397
|
+
async?: boolean | null | undefined;
|
|
392
398
|
namespace?: string | null | undefined;
|
|
393
399
|
} | {
|
|
394
400
|
type: "web_search_call";
|
|
@@ -451,6 +457,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
451
457
|
call_id: string;
|
|
452
458
|
name: string;
|
|
453
459
|
input: string;
|
|
460
|
+
async?: boolean | null | undefined;
|
|
454
461
|
} | {
|
|
455
462
|
type: "shell_call";
|
|
456
463
|
id: string;
|
|
@@ -519,6 +526,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
519
526
|
name: string;
|
|
520
527
|
arguments: string;
|
|
521
528
|
status: "completed";
|
|
529
|
+
async?: boolean | null | undefined;
|
|
522
530
|
namespace?: string | null | undefined;
|
|
523
531
|
} | {
|
|
524
532
|
type: "custom_tool_call";
|
|
@@ -527,6 +535,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
527
535
|
name: string;
|
|
528
536
|
input: string;
|
|
529
537
|
status: "completed";
|
|
538
|
+
async?: boolean | null | undefined;
|
|
530
539
|
} | {
|
|
531
540
|
type: "code_interpreter_call";
|
|
532
541
|
id: string;
|
|
@@ -779,6 +788,14 @@ type OpenaiResponsesReasoningProviderMetadata = {
|
|
|
779
788
|
type OpenaiResponsesProviderMetadata = {
|
|
780
789
|
openai: ResponsesProviderMetadata;
|
|
781
790
|
};
|
|
791
|
+
type ResponsesToolCallProviderMetadata = {
|
|
792
|
+
itemId: string;
|
|
793
|
+
async?: boolean;
|
|
794
|
+
namespace?: string;
|
|
795
|
+
};
|
|
796
|
+
type OpenaiResponsesToolCallProviderMetadata = {
|
|
797
|
+
openai: ResponsesToolCallProviderMetadata;
|
|
798
|
+
};
|
|
782
799
|
type ResponsesTextProviderMetadata = {
|
|
783
800
|
itemId: string;
|
|
784
801
|
phase?: 'commentary' | 'final_answer' | null;
|
|
@@ -1109,7 +1126,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
1109
1126
|
outputCompression?: number | undefined;
|
|
1110
1127
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
1111
1128
|
partialImages?: number | undefined;
|
|
1112
|
-
quality?: "low" | "medium" | "high" | "auto" | undefined;
|
|
1129
|
+
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | undefined;
|
|
1113
1130
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
|
|
1114
1131
|
}>;
|
|
1115
1132
|
declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
@@ -1161,15 +1178,18 @@ type ImageGenerationArgs = {
|
|
|
1161
1178
|
partialImages?: number;
|
|
1162
1179
|
/**
|
|
1163
1180
|
* The quality of the generated image.
|
|
1164
|
-
* One of low, medium, high, or auto. Default: auto.
|
|
1181
|
+
* One of low, medium, high, xhigh, max, or auto. Default: auto.
|
|
1182
|
+
* xhigh and max are supported by GPT Image 2.5 models.
|
|
1165
1183
|
*/
|
|
1166
|
-
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
1184
|
+
quality?: 'auto' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
1167
1185
|
/**
|
|
1168
1186
|
* The size of the generated image.
|
|
1169
|
-
* One of 1024x1024, 1024x1536, 1536x1024, or auto.
|
|
1187
|
+
* One of 1024x1024, 1024x1536, 1536x1024, or auto. GPT Image 2 and 2.5
|
|
1188
|
+
* models also accept arbitrary WIDTHxHEIGHT sizes where both are divisible
|
|
1189
|
+
* by 16, e.g. 1536x864.
|
|
1170
1190
|
* Default: auto.
|
|
1171
1191
|
*/
|
|
1172
|
-
size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
|
|
1192
|
+
size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | (string & {});
|
|
1173
1193
|
};
|
|
1174
1194
|
declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.Tool<{}, {
|
|
1175
1195
|
/**
|
|
@@ -1463,4 +1483,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
|
|
|
1463
1483
|
};
|
|
1464
1484
|
}>;
|
|
1465
1485
|
|
|
1466
|
-
export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
|
|
1486
|
+
export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
|
package/dist/internal/index.js
CHANGED
|
@@ -104,6 +104,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
104
104
|
supportsFlexProcessing,
|
|
105
105
|
supportsPriorityProcessing,
|
|
106
106
|
supportsConfigurationUpdate: isGpt6OrLaterModel,
|
|
107
|
+
supportsAsyncToolCalling: isGpt6OrLaterModel,
|
|
107
108
|
supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
108
109
|
isReasoningModel,
|
|
109
110
|
systemMessageMode,
|
|
@@ -2091,6 +2092,10 @@ var modelMaxImagesPerCall = {
|
|
|
2091
2092
|
"gpt-image-1-mini": 10,
|
|
2092
2093
|
"gpt-image-1.5": 10,
|
|
2093
2094
|
"gpt-image-2": 10,
|
|
2095
|
+
"gpt-image-2.5-flare": 10,
|
|
2096
|
+
"gpt-image-2.5-flare-2026-09-08": 10,
|
|
2097
|
+
"gpt-image-2.5-sunburst": 10,
|
|
2098
|
+
"gpt-image-2.5-sunburst-2026-09-08": 10,
|
|
2094
2099
|
"chatgpt-image-latest": 10
|
|
2095
2100
|
};
|
|
2096
2101
|
var defaultResponseFormatPrefixes = ["chatgpt-image-", "gpt-image-"];
|
|
@@ -2107,9 +2112,10 @@ var baseImageModelOptionsObject = import_v49.z.object({
|
|
|
2107
2112
|
/**
|
|
2108
2113
|
* Quality of the generated image(s).
|
|
2109
2114
|
*
|
|
2110
|
-
* Valid values: `standard`, `hd`, `low`, `medium`, `high`, `auto`.
|
|
2115
|
+
* Valid values: `standard`, `hd`, `low`, `medium`, `high`, `xhigh`, `max`, `auto`.
|
|
2116
|
+
* `xhigh` and `max` are supported by GPT Image 2.5 models.
|
|
2111
2117
|
*/
|
|
2112
|
-
quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "auto"]).optional(),
|
|
2118
|
+
quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "xhigh", "max", "auto"]).optional(),
|
|
2113
2119
|
/**
|
|
2114
2120
|
* Background behavior for the generated image(s).
|
|
2115
2121
|
*
|
|
@@ -3229,6 +3235,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3229
3235
|
toolNameMapping,
|
|
3230
3236
|
systemMessageMode,
|
|
3231
3237
|
providerOptionsName,
|
|
3238
|
+
explicitMessageItemType = false,
|
|
3232
3239
|
fileIdPrefixes,
|
|
3233
3240
|
passThroughUnsupportedFiles = false,
|
|
3234
3241
|
store,
|
|
@@ -3240,7 +3247,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3240
3247
|
toolSearchToolName,
|
|
3241
3248
|
customProviderToolNames
|
|
3242
3249
|
}) {
|
|
3243
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
3250
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
3244
3251
|
let input = [];
|
|
3245
3252
|
const warnings = [];
|
|
3246
3253
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -3260,6 +3267,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3260
3267
|
providerOptionsName
|
|
3261
3268
|
);
|
|
3262
3269
|
input.push({
|
|
3270
|
+
...explicitMessageItemType && { type: "message" },
|
|
3263
3271
|
role: "system",
|
|
3264
3272
|
content: promptCacheBreakpoint == null ? content : [
|
|
3265
3273
|
{
|
|
@@ -3277,6 +3285,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3277
3285
|
providerOptionsName
|
|
3278
3286
|
);
|
|
3279
3287
|
input.push({
|
|
3288
|
+
...explicitMessageItemType && { type: "message" },
|
|
3280
3289
|
role: "developer",
|
|
3281
3290
|
content: promptCacheBreakpoint == null ? content : [
|
|
3282
3291
|
{
|
|
@@ -3306,6 +3315,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3306
3315
|
}
|
|
3307
3316
|
case "user": {
|
|
3308
3317
|
input.push({
|
|
3318
|
+
...explicitMessageItemType && { type: "message" },
|
|
3309
3319
|
role: "user",
|
|
3310
3320
|
content: content.map((part, index) => {
|
|
3311
3321
|
var _a3, _b2, _c2;
|
|
@@ -3387,6 +3397,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3387
3397
|
break;
|
|
3388
3398
|
}
|
|
3389
3399
|
input.push({
|
|
3400
|
+
...explicitMessageItemType && { type: "message" },
|
|
3390
3401
|
role: "assistant",
|
|
3391
3402
|
content: [{ type: "output_text", text: part.text }],
|
|
3392
3403
|
id,
|
|
@@ -3425,6 +3436,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3425
3436
|
}
|
|
3426
3437
|
const id = (_f = (_c = (_b = part.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? void 0 : _d[providerOptionsName]) == null ? void 0 : _e.itemId;
|
|
3427
3438
|
const namespace = (_k = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.namespace) != null ? _k : (_j = (_i = part.providerMetadata) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.namespace;
|
|
3439
|
+
const isAsync = (_p = (_m = (_l = part.providerOptions) == null ? void 0 : _l[providerOptionsName]) == null ? void 0 : _m.async) != null ? _p : (_o = (_n = part.providerMetadata) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.async;
|
|
3428
3440
|
if (hasConversation && id != null) {
|
|
3429
3441
|
break;
|
|
3430
3442
|
}
|
|
@@ -3448,7 +3460,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3448
3460
|
type: "tool_search_call",
|
|
3449
3461
|
id: id != null ? id : part.toolCallId,
|
|
3450
3462
|
execution,
|
|
3451
|
-
call_id: (
|
|
3463
|
+
call_id: (_q = parsedInput.call_id) != null ? _q : null,
|
|
3452
3464
|
status: "completed",
|
|
3453
3465
|
arguments: parsedInput.arguments
|
|
3454
3466
|
});
|
|
@@ -3462,7 +3474,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3462
3474
|
break;
|
|
3463
3475
|
}
|
|
3464
3476
|
}
|
|
3465
|
-
const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((
|
|
3477
|
+
const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_r = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _r : false);
|
|
3466
3478
|
if (hasPreviousResponseId && store && id != null && isProviderDefinedToolCall) {
|
|
3467
3479
|
break;
|
|
3468
3480
|
}
|
|
@@ -3528,6 +3540,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3528
3540
|
call_id: part.toolCallId,
|
|
3529
3541
|
name: resolvedToolName,
|
|
3530
3542
|
input: typeof part.input === "string" ? part.input : JSON.stringify(part.input),
|
|
3543
|
+
...isAsync != null && { async: isAsync },
|
|
3531
3544
|
id
|
|
3532
3545
|
});
|
|
3533
3546
|
break;
|
|
@@ -3537,6 +3550,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3537
3550
|
call_id: part.toolCallId,
|
|
3538
3551
|
name: resolvedToolName,
|
|
3539
3552
|
arguments: serializeToolCallArguments2(part.input),
|
|
3553
|
+
...isAsync != null && { async: isAsync },
|
|
3540
3554
|
...namespace != null && { namespace }
|
|
3541
3555
|
});
|
|
3542
3556
|
break;
|
|
@@ -3553,7 +3567,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3553
3567
|
part.toolName
|
|
3554
3568
|
);
|
|
3555
3569
|
if (part.toolName === toolSearchToolName) {
|
|
3556
|
-
const itemId = (
|
|
3570
|
+
const itemId = (_x = (_w = (_t = (_s = part.providerOptions) == null ? void 0 : _s[providerOptionsName]) == null ? void 0 : _t.itemId) != null ? _w : (_v = (_u = part.providerMetadata) == null ? void 0 : _u[providerOptionsName]) == null ? void 0 : _v.itemId) != null ? _x : part.toolCallId;
|
|
3557
3571
|
if (store) {
|
|
3558
3572
|
input.push({ type: "item_reference", id: itemId });
|
|
3559
3573
|
} else if (part.output.type === "json") {
|
|
@@ -3594,7 +3608,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3594
3608
|
break;
|
|
3595
3609
|
}
|
|
3596
3610
|
if (store) {
|
|
3597
|
-
const itemId = (
|
|
3611
|
+
const itemId = (_A = (_z = (_y = part.providerOptions) == null ? void 0 : _y[providerOptionsName]) == null ? void 0 : _z.itemId) != null ? _A : part.toolCallId;
|
|
3598
3612
|
input.push({ type: "item_reference", id: itemId });
|
|
3599
3613
|
} else {
|
|
3600
3614
|
warnings.push({
|
|
@@ -3761,7 +3775,7 @@ ${text}`,
|
|
|
3761
3775
|
}
|
|
3762
3776
|
const output = part.output;
|
|
3763
3777
|
if (output.type === "execution-denied") {
|
|
3764
|
-
const approvalId = (
|
|
3778
|
+
const approvalId = (_C = (_B = output.providerOptions) == null ? void 0 : _B.openai) == null ? void 0 : _C.approvalId;
|
|
3765
3779
|
if (approvalId) {
|
|
3766
3780
|
continue;
|
|
3767
3781
|
}
|
|
@@ -3848,7 +3862,7 @@ ${text}`,
|
|
|
3848
3862
|
break;
|
|
3849
3863
|
case "execution-denied":
|
|
3850
3864
|
outputValue = convertScalarOutput(
|
|
3851
|
-
(
|
|
3865
|
+
(_D = output.reason) != null ? _D : "Tool call execution denied."
|
|
3852
3866
|
);
|
|
3853
3867
|
break;
|
|
3854
3868
|
case "json":
|
|
@@ -4186,6 +4200,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4186
4200
|
call_id: import_v418.z.string(),
|
|
4187
4201
|
name: import_v418.z.string(),
|
|
4188
4202
|
arguments: import_v418.z.string(),
|
|
4203
|
+
async: import_v418.z.boolean().nullish(),
|
|
4189
4204
|
namespace: import_v418.z.string().nullish()
|
|
4190
4205
|
}),
|
|
4191
4206
|
import_v418.z.object({
|
|
@@ -4261,7 +4276,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4261
4276
|
id: import_v418.z.string(),
|
|
4262
4277
|
call_id: import_v418.z.string(),
|
|
4263
4278
|
name: import_v418.z.string(),
|
|
4264
|
-
input: import_v418.z.string()
|
|
4279
|
+
input: import_v418.z.string(),
|
|
4280
|
+
async: import_v418.z.boolean().nullish()
|
|
4265
4281
|
}),
|
|
4266
4282
|
import_v418.z.object({
|
|
4267
4283
|
type: import_v418.z.literal("shell_call"),
|
|
@@ -4329,6 +4345,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4329
4345
|
call_id: import_v418.z.string(),
|
|
4330
4346
|
name: import_v418.z.string(),
|
|
4331
4347
|
arguments: import_v418.z.string(),
|
|
4348
|
+
async: import_v418.z.boolean().nullish(),
|
|
4332
4349
|
status: import_v418.z.literal("completed"),
|
|
4333
4350
|
namespace: import_v418.z.string().nullish()
|
|
4334
4351
|
}),
|
|
@@ -4338,6 +4355,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4338
4355
|
call_id: import_v418.z.string(),
|
|
4339
4356
|
name: import_v418.z.string(),
|
|
4340
4357
|
input: import_v418.z.string(),
|
|
4358
|
+
async: import_v418.z.boolean().nullish(),
|
|
4341
4359
|
status: import_v418.z.literal("completed")
|
|
4342
4360
|
}),
|
|
4343
4361
|
import_v418.z.object({
|
|
@@ -4771,6 +4789,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4771
4789
|
name: import_v418.z.string(),
|
|
4772
4790
|
arguments: import_v418.z.string(),
|
|
4773
4791
|
id: import_v418.z.string(),
|
|
4792
|
+
async: import_v418.z.boolean().nullish(),
|
|
4774
4793
|
namespace: import_v418.z.string().nullish()
|
|
4775
4794
|
}),
|
|
4776
4795
|
import_v418.z.object({
|
|
@@ -4778,7 +4797,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4778
4797
|
call_id: import_v418.z.string(),
|
|
4779
4798
|
name: import_v418.z.string(),
|
|
4780
4799
|
input: import_v418.z.string(),
|
|
4781
|
-
id: import_v418.z.string()
|
|
4800
|
+
id: import_v418.z.string(),
|
|
4801
|
+
async: import_v418.z.boolean().nullish()
|
|
4782
4802
|
}),
|
|
4783
4803
|
import_v418.z.object({
|
|
4784
4804
|
type: import_v418.z.literal("computer_call"),
|
|
@@ -5316,7 +5336,7 @@ var imageGenerationArgsSchema = (0, import_provider_utils30.lazySchema)(
|
|
|
5316
5336
|
outputCompression: import_v422.z.number().int().min(0).max(100).optional(),
|
|
5317
5337
|
outputFormat: import_v422.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
5318
5338
|
partialImages: import_v422.z.number().int().min(0).max(3).optional(),
|
|
5319
|
-
quality: import_v422.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
5339
|
+
quality: import_v422.z.enum(["auto", "low", "medium", "high", "xhigh", "max"]).optional(),
|
|
5320
5340
|
size: import_v422.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
5321
5341
|
}).strict()
|
|
5322
5342
|
)
|
|
@@ -5342,6 +5362,7 @@ var customArgsSchema = (0, import_provider_utils31.lazySchema)(
|
|
|
5342
5362
|
import_v423.z.object({
|
|
5343
5363
|
name: import_v423.z.string(),
|
|
5344
5364
|
description: import_v423.z.string().optional(),
|
|
5365
|
+
async: import_v423.z.boolean().optional(),
|
|
5345
5366
|
format: import_v423.z.union([
|
|
5346
5367
|
import_v423.z.object({
|
|
5347
5368
|
type: import_v423.z.literal("grammar"),
|
|
@@ -5534,7 +5555,8 @@ async function prepareResponsesTools({
|
|
|
5534
5555
|
toolChoice,
|
|
5535
5556
|
allowedTools,
|
|
5536
5557
|
toolNameMapping,
|
|
5537
|
-
customProviderToolNames
|
|
5558
|
+
customProviderToolNames,
|
|
5559
|
+
supportsAsyncToolCalling = true
|
|
5538
5560
|
}) {
|
|
5539
5561
|
var _a2, _b, _c, _d;
|
|
5540
5562
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -5565,7 +5587,13 @@ async function prepareResponsesTools({
|
|
|
5565
5587
|
const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
|
|
5566
5588
|
const openaiFunctionTool = prepareFunctionTool({
|
|
5567
5589
|
tool,
|
|
5568
|
-
options: openaiOptions
|
|
5590
|
+
options: openaiOptions,
|
|
5591
|
+
async: resolveAsyncToolOption({
|
|
5592
|
+
value: openaiOptions == null ? void 0 : openaiOptions.async,
|
|
5593
|
+
supportsAsyncToolCalling,
|
|
5594
|
+
toolName: tool.name,
|
|
5595
|
+
toolWarnings
|
|
5596
|
+
})
|
|
5569
5597
|
});
|
|
5570
5598
|
const namespace = openaiOptions == null ? void 0 : openaiOptions.namespace;
|
|
5571
5599
|
if (namespace == null) {
|
|
@@ -5747,6 +5775,12 @@ async function prepareResponsesTools({
|
|
|
5747
5775
|
type: "custom",
|
|
5748
5776
|
name: args.name,
|
|
5749
5777
|
description: args.description,
|
|
5778
|
+
...resolveAsyncToolOption({
|
|
5779
|
+
value: args.async,
|
|
5780
|
+
supportsAsyncToolCalling,
|
|
5781
|
+
toolName: args.name,
|
|
5782
|
+
toolWarnings
|
|
5783
|
+
}) != null ? { async: args.async } : {},
|
|
5750
5784
|
format: args.format
|
|
5751
5785
|
});
|
|
5752
5786
|
resolvedCustomProviderToolNames.add(args.name);
|
|
@@ -5918,7 +5952,8 @@ function toAllowedToolResolution(tool) {
|
|
|
5918
5952
|
}
|
|
5919
5953
|
function prepareFunctionTool({
|
|
5920
5954
|
tool,
|
|
5921
|
-
options
|
|
5955
|
+
options,
|
|
5956
|
+
async
|
|
5922
5957
|
}) {
|
|
5923
5958
|
const deferLoading = options == null ? void 0 : options.deferLoading;
|
|
5924
5959
|
return {
|
|
@@ -5926,10 +5961,27 @@ function prepareFunctionTool({
|
|
|
5926
5961
|
name: tool.name,
|
|
5927
5962
|
description: tool.description,
|
|
5928
5963
|
parameters: tool.inputSchema,
|
|
5964
|
+
...async != null ? { async } : {},
|
|
5929
5965
|
...tool.strict != null ? { strict: tool.strict } : {},
|
|
5930
5966
|
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
5931
5967
|
};
|
|
5932
5968
|
}
|
|
5969
|
+
function resolveAsyncToolOption({
|
|
5970
|
+
value,
|
|
5971
|
+
supportsAsyncToolCalling,
|
|
5972
|
+
toolName,
|
|
5973
|
+
toolWarnings
|
|
5974
|
+
}) {
|
|
5975
|
+
if (value !== true || supportsAsyncToolCalling) {
|
|
5976
|
+
return value;
|
|
5977
|
+
}
|
|
5978
|
+
toolWarnings.push({
|
|
5979
|
+
type: "unsupported",
|
|
5980
|
+
feature: `async tool calling for "${toolName}"`,
|
|
5981
|
+
details: "Async tool calling is only supported by GPT-6 and later models."
|
|
5982
|
+
});
|
|
5983
|
+
return void 0;
|
|
5984
|
+
}
|
|
5933
5985
|
function mapShellEnvironment(environment) {
|
|
5934
5986
|
if (environment.type === "containerReference") {
|
|
5935
5987
|
const env2 = environment;
|
|
@@ -6097,13 +6149,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6097
6149
|
toolChoice,
|
|
6098
6150
|
allowedTools: (_b = openaiOptions == null ? void 0 : openaiOptions.allowedTools) != null ? _b : void 0,
|
|
6099
6151
|
toolNameMapping,
|
|
6100
|
-
customProviderToolNames
|
|
6152
|
+
customProviderToolNames,
|
|
6153
|
+
supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
|
|
6101
6154
|
});
|
|
6102
6155
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
6103
6156
|
prompt,
|
|
6104
6157
|
toolNameMapping,
|
|
6105
6158
|
systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
6106
6159
|
providerOptionsName,
|
|
6160
|
+
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
6107
6161
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
6108
6162
|
passThroughUnsupportedFiles: (_d = openaiOptions == null ? void 0 : openaiOptions.passThroughUnsupportedFiles) != null ? _d : false,
|
|
6109
6163
|
store: (_e = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _e : true,
|
|
@@ -6607,6 +6661,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6607
6661
|
providerMetadata: {
|
|
6608
6662
|
[providerOptionsName]: {
|
|
6609
6663
|
itemId: part.id,
|
|
6664
|
+
...part.async != null && { async: part.async },
|
|
6610
6665
|
...part.namespace != null && { namespace: part.namespace }
|
|
6611
6666
|
}
|
|
6612
6667
|
}
|
|
@@ -6623,7 +6678,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6623
6678
|
input: JSON.stringify(part.input),
|
|
6624
6679
|
providerMetadata: {
|
|
6625
6680
|
[providerOptionsName]: {
|
|
6626
|
-
itemId: part.id
|
|
6681
|
+
itemId: part.id,
|
|
6682
|
+
...part.async != null && { async: part.async }
|
|
6627
6683
|
}
|
|
6628
6684
|
}
|
|
6629
6685
|
});
|
|
@@ -6911,7 +6967,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6911
6967
|
toolName: value.item.name,
|
|
6912
6968
|
toolCallId: value.item.call_id,
|
|
6913
6969
|
suppressInputStreaming,
|
|
6914
|
-
bufferedInputDeltas: suppressInputStreaming ? [] : void 0
|
|
6970
|
+
bufferedInputDeltas: suppressInputStreaming ? [] : void 0,
|
|
6971
|
+
async: value.item.async
|
|
6915
6972
|
};
|
|
6916
6973
|
if (!suppressInputStreaming) {
|
|
6917
6974
|
controller.enqueue({
|
|
@@ -6926,7 +6983,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6926
6983
|
);
|
|
6927
6984
|
ongoingToolCalls[value.output_index] = {
|
|
6928
6985
|
toolName,
|
|
6929
|
-
toolCallId: value.item.call_id
|
|
6986
|
+
toolCallId: value.item.call_id,
|
|
6987
|
+
async: value.item.async
|
|
6930
6988
|
};
|
|
6931
6989
|
controller.enqueue({
|
|
6932
6990
|
type: "tool-input-start",
|
|
@@ -7170,6 +7228,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7170
7228
|
providerMetadata: {
|
|
7171
7229
|
[providerOptionsName]: {
|
|
7172
7230
|
itemId: item.id,
|
|
7231
|
+
...item.async != null ? { async: item.async } : (ongoingToolCall == null ? void 0 : ongoingToolCall.async) != null ? { async: ongoingToolCall.async } : {},
|
|
7173
7232
|
...item.namespace != null && {
|
|
7174
7233
|
namespace: item.namespace
|
|
7175
7234
|
}
|
|
@@ -7214,6 +7273,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7214
7273
|
}
|
|
7215
7274
|
});
|
|
7216
7275
|
} else if (value.item.type === "custom_tool_call") {
|
|
7276
|
+
const ongoingToolCall = ongoingToolCalls[value.output_index];
|
|
7217
7277
|
ongoingToolCalls[value.output_index] = void 0;
|
|
7218
7278
|
hasFunctionCall = true;
|
|
7219
7279
|
const toolName = toolNameMapping.toCustomToolName(
|
|
@@ -7230,7 +7290,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7230
7290
|
input: JSON.stringify(value.item.input),
|
|
7231
7291
|
providerMetadata: {
|
|
7232
7292
|
[providerOptionsName]: {
|
|
7233
|
-
itemId: value.item.id
|
|
7293
|
+
itemId: value.item.id,
|
|
7294
|
+
...value.item.async != null ? { async: value.item.async } : (ongoingToolCall == null ? void 0 : ongoingToolCall.async) != null ? { async: ongoingToolCall.async } : {}
|
|
7234
7295
|
}
|
|
7235
7296
|
}
|
|
7236
7297
|
});
|