@ai-sdk/openai 2.0.30 → 2.0.32
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 +15 -0
- package/dist/index.d.mts +85 -23
- package/dist/index.d.ts +85 -23
- package/dist/index.js +773 -690
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +712 -629
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +13 -12
- package/dist/internal/index.d.ts +13 -12
- package/dist/internal/index.js +760 -694
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +701 -635
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.0.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1cf857d: fix(provider/openai): remove provider-executed tools from chat completions model
|
|
8
|
+
- 01de47f: feat(provider/openai): rework file search tool
|
|
9
|
+
|
|
10
|
+
## 2.0.31
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- bb94467: feat(provider/openai): add maxToolCalls provider option
|
|
15
|
+
- 4a2b70e: feat(provider/openai): send item references for provider-executed tool results
|
|
16
|
+
- 643711d: feat (provider/openai): provider defined image generation tool support
|
|
17
|
+
|
|
3
18
|
## 2.0.30
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -57,6 +57,37 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
|
|
|
57
57
|
};
|
|
58
58
|
}>;
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
62
|
+
*/
|
|
63
|
+
type OpenAIResponsesFileSearchToolComparisonFilter = {
|
|
64
|
+
/**
|
|
65
|
+
* The key to compare against the value.
|
|
66
|
+
*/
|
|
67
|
+
key: string;
|
|
68
|
+
/**
|
|
69
|
+
* Specifies the comparison operator: eq, ne, gt, gte, lt, lte.
|
|
70
|
+
*/
|
|
71
|
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
72
|
+
/**
|
|
73
|
+
* The value to compare against the attribute key; supports string, number, or boolean types.
|
|
74
|
+
*/
|
|
75
|
+
value: string | number | boolean;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Combine multiple filters using and or or.
|
|
79
|
+
*/
|
|
80
|
+
type OpenAIResponsesFileSearchToolCompoundFilter = {
|
|
81
|
+
/**
|
|
82
|
+
* Type of operation: and or or.
|
|
83
|
+
*/
|
|
84
|
+
type: 'and' | 'or';
|
|
85
|
+
/**
|
|
86
|
+
* Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
|
|
87
|
+
*/
|
|
88
|
+
filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
|
|
89
|
+
};
|
|
90
|
+
|
|
60
91
|
declare const openaiTools: {
|
|
61
92
|
/**
|
|
62
93
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
@@ -95,22 +126,52 @@ declare const openaiTools: {
|
|
|
95
126
|
* @param ranking - The ranking options to use for the file search.
|
|
96
127
|
* @param filters - The filters to use for the file search.
|
|
97
128
|
*/
|
|
98
|
-
fileSearch: _ai_sdk_provider_utils.
|
|
99
|
-
|
|
129
|
+
fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
130
|
+
queries: string[];
|
|
131
|
+
results: null | {
|
|
132
|
+
attributes: Record<string, unknown>;
|
|
133
|
+
fileId: string;
|
|
134
|
+
filename: string;
|
|
135
|
+
score: number;
|
|
136
|
+
text: string;
|
|
137
|
+
}[];
|
|
100
138
|
}, {
|
|
101
|
-
vectorStoreIds
|
|
139
|
+
vectorStoreIds: string[];
|
|
102
140
|
maxNumResults?: number;
|
|
103
141
|
ranking?: {
|
|
104
|
-
ranker?:
|
|
142
|
+
ranker?: string;
|
|
143
|
+
scoreThreshold?: number;
|
|
105
144
|
};
|
|
106
|
-
filters?:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
145
|
+
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* The image generation tool allows you to generate images using a text prompt,
|
|
149
|
+
* and optionally image inputs. It leverages the GPT Image model,
|
|
150
|
+
* and automatically optimizes text inputs for improved performance.
|
|
151
|
+
*
|
|
152
|
+
* Must have name `image_generation`.
|
|
153
|
+
*
|
|
154
|
+
* @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
|
|
155
|
+
* @param quality - Rendering quality (e.g. low, medium, high)
|
|
156
|
+
* @param format - File output format
|
|
157
|
+
* @param compression - Compression level (0-100%) for JPEG and WebP formats
|
|
158
|
+
* @param background - Transparent or opaque
|
|
159
|
+
*/
|
|
160
|
+
imageGeneration: (args?: {
|
|
161
|
+
background?: "auto" | "opaque" | "transparent";
|
|
162
|
+
inputFidelity?: "low" | "high";
|
|
163
|
+
inputImageMask?: {
|
|
164
|
+
fileId?: string;
|
|
165
|
+
imageUrl?: string;
|
|
113
166
|
};
|
|
167
|
+
model?: string;
|
|
168
|
+
moderation?: "auto";
|
|
169
|
+
outputCompression?: number;
|
|
170
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
171
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
172
|
+
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
173
|
+
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
174
|
+
result: string;
|
|
114
175
|
}>;
|
|
115
176
|
/**
|
|
116
177
|
* Web search allows models to access up-to-date information from the internet
|
|
@@ -244,33 +305,34 @@ Default OpenAI provider instance.
|
|
|
244
305
|
declare const openai: OpenAIProvider;
|
|
245
306
|
|
|
246
307
|
declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
308
|
+
include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
309
|
+
"file_search_call.results": "file_search_call.results";
|
|
310
|
+
"message.output_text.logprobs": "message.output_text.logprobs";
|
|
311
|
+
"reasoning.encrypted_content": "reasoning.encrypted_content";
|
|
312
|
+
}>>>>;
|
|
313
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
314
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
315
|
+
maxToolCalls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
247
316
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
248
317
|
parallelToolCalls: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
249
318
|
previousResponseId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
-
|
|
251
|
-
user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
319
|
+
promptCacheKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
320
|
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
-
strictJsonSchema: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
254
|
-
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
255
321
|
reasoningSummary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
322
|
+
safetyIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
256
323
|
serviceTier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
257
324
|
auto: "auto";
|
|
258
325
|
flex: "flex";
|
|
259
326
|
priority: "priority";
|
|
260
327
|
}>>>;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
"message.output_text.logprobs": "message.output_text.logprobs";
|
|
264
|
-
"reasoning.encrypted_content": "reasoning.encrypted_content";
|
|
265
|
-
}>>>>;
|
|
328
|
+
store: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
329
|
+
strictJsonSchema: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
266
330
|
textVerbosity: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
267
331
|
low: "low";
|
|
268
332
|
medium: "medium";
|
|
269
333
|
high: "high";
|
|
270
334
|
}>>>;
|
|
271
|
-
|
|
272
|
-
safetyIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
273
|
-
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
335
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
274
336
|
}, z.core.$strip>;
|
|
275
337
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
276
338
|
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,37 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
|
|
|
57
57
|
};
|
|
58
58
|
}>;
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
62
|
+
*/
|
|
63
|
+
type OpenAIResponsesFileSearchToolComparisonFilter = {
|
|
64
|
+
/**
|
|
65
|
+
* The key to compare against the value.
|
|
66
|
+
*/
|
|
67
|
+
key: string;
|
|
68
|
+
/**
|
|
69
|
+
* Specifies the comparison operator: eq, ne, gt, gte, lt, lte.
|
|
70
|
+
*/
|
|
71
|
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
72
|
+
/**
|
|
73
|
+
* The value to compare against the attribute key; supports string, number, or boolean types.
|
|
74
|
+
*/
|
|
75
|
+
value: string | number | boolean;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Combine multiple filters using and or or.
|
|
79
|
+
*/
|
|
80
|
+
type OpenAIResponsesFileSearchToolCompoundFilter = {
|
|
81
|
+
/**
|
|
82
|
+
* Type of operation: and or or.
|
|
83
|
+
*/
|
|
84
|
+
type: 'and' | 'or';
|
|
85
|
+
/**
|
|
86
|
+
* Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
|
|
87
|
+
*/
|
|
88
|
+
filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
|
|
89
|
+
};
|
|
90
|
+
|
|
60
91
|
declare const openaiTools: {
|
|
61
92
|
/**
|
|
62
93
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
@@ -95,22 +126,52 @@ declare const openaiTools: {
|
|
|
95
126
|
* @param ranking - The ranking options to use for the file search.
|
|
96
127
|
* @param filters - The filters to use for the file search.
|
|
97
128
|
*/
|
|
98
|
-
fileSearch: _ai_sdk_provider_utils.
|
|
99
|
-
|
|
129
|
+
fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
130
|
+
queries: string[];
|
|
131
|
+
results: null | {
|
|
132
|
+
attributes: Record<string, unknown>;
|
|
133
|
+
fileId: string;
|
|
134
|
+
filename: string;
|
|
135
|
+
score: number;
|
|
136
|
+
text: string;
|
|
137
|
+
}[];
|
|
100
138
|
}, {
|
|
101
|
-
vectorStoreIds
|
|
139
|
+
vectorStoreIds: string[];
|
|
102
140
|
maxNumResults?: number;
|
|
103
141
|
ranking?: {
|
|
104
|
-
ranker?:
|
|
142
|
+
ranker?: string;
|
|
143
|
+
scoreThreshold?: number;
|
|
105
144
|
};
|
|
106
|
-
filters?:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
145
|
+
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* The image generation tool allows you to generate images using a text prompt,
|
|
149
|
+
* and optionally image inputs. It leverages the GPT Image model,
|
|
150
|
+
* and automatically optimizes text inputs for improved performance.
|
|
151
|
+
*
|
|
152
|
+
* Must have name `image_generation`.
|
|
153
|
+
*
|
|
154
|
+
* @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
|
|
155
|
+
* @param quality - Rendering quality (e.g. low, medium, high)
|
|
156
|
+
* @param format - File output format
|
|
157
|
+
* @param compression - Compression level (0-100%) for JPEG and WebP formats
|
|
158
|
+
* @param background - Transparent or opaque
|
|
159
|
+
*/
|
|
160
|
+
imageGeneration: (args?: {
|
|
161
|
+
background?: "auto" | "opaque" | "transparent";
|
|
162
|
+
inputFidelity?: "low" | "high";
|
|
163
|
+
inputImageMask?: {
|
|
164
|
+
fileId?: string;
|
|
165
|
+
imageUrl?: string;
|
|
113
166
|
};
|
|
167
|
+
model?: string;
|
|
168
|
+
moderation?: "auto";
|
|
169
|
+
outputCompression?: number;
|
|
170
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
171
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
172
|
+
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
173
|
+
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
174
|
+
result: string;
|
|
114
175
|
}>;
|
|
115
176
|
/**
|
|
116
177
|
* Web search allows models to access up-to-date information from the internet
|
|
@@ -244,33 +305,34 @@ Default OpenAI provider instance.
|
|
|
244
305
|
declare const openai: OpenAIProvider;
|
|
245
306
|
|
|
246
307
|
declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
308
|
+
include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
309
|
+
"file_search_call.results": "file_search_call.results";
|
|
310
|
+
"message.output_text.logprobs": "message.output_text.logprobs";
|
|
311
|
+
"reasoning.encrypted_content": "reasoning.encrypted_content";
|
|
312
|
+
}>>>>;
|
|
313
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
314
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
315
|
+
maxToolCalls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
247
316
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
248
317
|
parallelToolCalls: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
249
318
|
previousResponseId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
-
|
|
251
|
-
user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
319
|
+
promptCacheKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
320
|
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
-
strictJsonSchema: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
254
|
-
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
255
321
|
reasoningSummary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
322
|
+
safetyIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
256
323
|
serviceTier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
257
324
|
auto: "auto";
|
|
258
325
|
flex: "flex";
|
|
259
326
|
priority: "priority";
|
|
260
327
|
}>>>;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
"message.output_text.logprobs": "message.output_text.logprobs";
|
|
264
|
-
"reasoning.encrypted_content": "reasoning.encrypted_content";
|
|
265
|
-
}>>>>;
|
|
328
|
+
store: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
329
|
+
strictJsonSchema: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
266
330
|
textVerbosity: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
267
331
|
low: "low";
|
|
268
332
|
medium: "medium";
|
|
269
333
|
high: "high";
|
|
270
334
|
}>>>;
|
|
271
|
-
|
|
272
|
-
safetyIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
273
|
-
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
335
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
274
336
|
}, z.core.$strip>;
|
|
275
337
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
276
338
|
|