@ai-sdk/openai 2.0.0-beta.11 → 2.0.0-beta.13

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,21 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.0-beta.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e7fcc86]
8
+ - @ai-sdk/provider-utils@3.0.0-beta.7
9
+
10
+ ## 2.0.0-beta.12
11
+
12
+ ### Patch Changes
13
+
14
+ - d521cda: feat(openai): add file_search filters and update field names
15
+ - 0059ee2: fix(openai): update file_search fields to match API changes
16
+ - Updated dependencies [ac34802]
17
+ - @ai-sdk/provider-utils@3.0.0-beta.6
18
+
3
19
  ## 2.0.0-beta.11
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -16,8 +16,18 @@ declare const openaiTools: {
16
16
  query: string;
17
17
  }, {
18
18
  vectorStoreIds?: string[];
19
- maxResults?: number;
20
- searchType?: "auto" | "keyword" | "semantic";
19
+ maxNumResults?: number;
20
+ ranking?: {
21
+ ranker?: "auto" | "keyword" | "semantic";
22
+ };
23
+ filters?: {
24
+ key: string;
25
+ type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
26
+ value: string | number | boolean;
27
+ } | {
28
+ type: "and" | "or";
29
+ filters: any[];
30
+ };
21
31
  }>;
22
32
  webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
23
33
  searchContextSize?: "low" | "medium" | "high";
package/dist/index.d.ts CHANGED
@@ -16,8 +16,18 @@ declare const openaiTools: {
16
16
  query: string;
17
17
  }, {
18
18
  vectorStoreIds?: string[];
19
- maxResults?: number;
20
- searchType?: "auto" | "keyword" | "semantic";
19
+ maxNumResults?: number;
20
+ ranking?: {
21
+ ranker?: "auto" | "keyword" | "semantic";
22
+ };
23
+ filters?: {
24
+ key: string;
25
+ type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
26
+ value: string | number | boolean;
27
+ } | {
28
+ type: "and" | "or";
29
+ filters: any[];
30
+ };
21
31
  }>;
22
32
  webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
23
33
  searchContextSize?: "low" | "medium" | "high";
package/dist/index.js CHANGED
@@ -336,6 +336,18 @@ var import_provider2 = require("@ai-sdk/provider");
336
336
  // src/tool/file-search.ts
337
337
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
338
338
  var import_v43 = require("zod/v4");
339
+ var comparisonFilterSchema = import_v43.z.object({
340
+ key: import_v43.z.string(),
341
+ type: import_v43.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
342
+ value: import_v43.z.union([import_v43.z.string(), import_v43.z.number(), import_v43.z.boolean()])
343
+ });
344
+ var compoundFilterSchema = import_v43.z.object({
345
+ type: import_v43.z.enum(["and", "or"]),
346
+ filters: import_v43.z.array(
347
+ import_v43.z.union([comparisonFilterSchema, import_v43.z.lazy(() => compoundFilterSchema)])
348
+ )
349
+ });
350
+ var filtersSchema = import_v43.z.union([comparisonFilterSchema, compoundFilterSchema]);
339
351
  var fileSearchArgsSchema = import_v43.z.object({
340
352
  /**
341
353
  * List of vector store IDs to search through. If not provided, searches all available vector stores.
@@ -344,11 +356,17 @@ var fileSearchArgsSchema = import_v43.z.object({
344
356
  /**
345
357
  * Maximum number of search results to return. Defaults to 10.
346
358
  */
347
- maxResults: import_v43.z.number().optional(),
359
+ maxNumResults: import_v43.z.number().optional(),
360
+ /**
361
+ * Ranking options for the search.
362
+ */
363
+ ranking: import_v43.z.object({
364
+ ranker: import_v43.z.enum(["auto", "keyword", "semantic"]).optional()
365
+ }).optional(),
348
366
  /**
349
- * Type of search to perform. Defaults to 'auto'.
367
+ * A filter to apply based on file attributes.
350
368
  */
351
- searchType: import_v43.z.enum(["auto", "keyword", "semantic"]).optional()
369
+ filters: filtersSchema.optional()
352
370
  });
353
371
  var fileSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
354
372
  id: "openai.file_search",
@@ -434,8 +452,9 @@ function prepareTools({
434
452
  openaiTools2.push({
435
453
  type: "file_search",
436
454
  vector_store_ids: args.vectorStoreIds,
437
- max_results: args.maxResults,
438
- search_type: args.searchType
455
+ max_num_results: args.maxNumResults,
456
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
457
+ filters: args.filters
439
458
  });
440
459
  break;
441
460
  }
@@ -2108,8 +2127,9 @@ function prepareResponsesTools({
2108
2127
  openaiTools2.push({
2109
2128
  type: "file_search",
2110
2129
  vector_store_ids: args.vectorStoreIds,
2111
- max_results: args.maxResults,
2112
- search_type: args.searchType
2130
+ max_num_results: args.maxNumResults,
2131
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
2132
+ filters: args.filters
2113
2133
  });
2114
2134
  break;
2115
2135
  }