@zenning/openai 2.0.29 → 2.1.0

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,45 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.1.0-beta.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 78928cb: release: start 5.1 beta
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [78928cb]
12
+ - @ai-sdk/provider@2.1.0-beta.0
13
+ - @ai-sdk/provider-utils@3.1.0-beta.0
14
+
15
+ ## 2.0.32
16
+
17
+ ### Patch Changes
18
+
19
+ - 1cf857d: fix(provider/openai): remove provider-executed tools from chat completions model
20
+ - 01de47f: feat(provider/openai): rework file search tool
21
+
22
+ ## 2.0.31
23
+
24
+ ### Patch Changes
25
+
26
+ - bb94467: feat(provider/openai): add maxToolCalls provider option
27
+ - 4a2b70e: feat(provider/openai): send item references for provider-executed tool results
28
+ - 643711d: feat (provider/openai): provider defined image generation tool support
29
+
30
+ ## 2.0.30
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [0294b58]
35
+ - @ai-sdk/provider-utils@3.0.9
36
+
37
+ ## 2.0.29
38
+
39
+ ### Patch Changes
40
+
41
+ - 4235eb3: feat(provider/openai): code interpreter tool calls and results
42
+
3
43
  ## 2.0.28
4
44
 
5
45
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
1
+ import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@zenning/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction } from '@ai-sdk/provider-utils';
4
4
  import { z } from 'zod/v4';
@@ -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.ProviderDefinedToolFactory<{
99
- query?: string;
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?: string[];
139
+ vectorStoreIds: string[];
102
140
  maxNumResults?: number;
103
141
  ranking?: {
104
- ranker?: "auto" | "default-2024-08-21";
142
+ ranker?: string;
143
+ scoreThreshold?: number;
105
144
  };
106
- filters?: {
107
- key: string;
108
- type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
109
- value: string | number | boolean;
110
- } | {
111
- type: "and" | "or";
112
- filters: any[];
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
- store: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
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
- include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
262
- "file_search_call.results": "file_search_call.results";
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
- promptCacheKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
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
@@ -1,4 +1,4 @@
1
- import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
1
+ import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@zenning/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction } from '@ai-sdk/provider-utils';
4
4
  import { z } from 'zod/v4';
@@ -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.ProviderDefinedToolFactory<{
99
- query?: string;
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?: string[];
139
+ vectorStoreIds: string[];
102
140
  maxNumResults?: number;
103
141
  ranking?: {
104
- ranker?: "auto" | "default-2024-08-21";
142
+ ranker?: string;
143
+ scoreThreshold?: number;
105
144
  };
106
- filters?: {
107
- key: string;
108
- type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
109
- value: string | number | boolean;
110
- } | {
111
- type: "and" | "or";
112
- filters: any[];
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
- store: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
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
- include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
262
- "file_search_call.results": "file_search_call.results";
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
- promptCacheKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
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