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

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.
@@ -344,6 +344,18 @@ var import_provider2 = require("@ai-sdk/provider");
344
344
  // src/tool/file-search.ts
345
345
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
346
346
  var import_v43 = require("zod/v4");
347
+ var comparisonFilterSchema = import_v43.z.object({
348
+ key: import_v43.z.string(),
349
+ type: import_v43.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
350
+ value: import_v43.z.union([import_v43.z.string(), import_v43.z.number(), import_v43.z.boolean()])
351
+ });
352
+ var compoundFilterSchema = import_v43.z.object({
353
+ type: import_v43.z.enum(["and", "or"]),
354
+ filters: import_v43.z.array(
355
+ import_v43.z.union([comparisonFilterSchema, import_v43.z.lazy(() => compoundFilterSchema)])
356
+ )
357
+ });
358
+ var filtersSchema = import_v43.z.union([comparisonFilterSchema, compoundFilterSchema]);
347
359
  var fileSearchArgsSchema = import_v43.z.object({
348
360
  /**
349
361
  * List of vector store IDs to search through. If not provided, searches all available vector stores.
@@ -352,11 +364,17 @@ var fileSearchArgsSchema = import_v43.z.object({
352
364
  /**
353
365
  * Maximum number of search results to return. Defaults to 10.
354
366
  */
355
- maxResults: import_v43.z.number().optional(),
367
+ maxNumResults: import_v43.z.number().optional(),
368
+ /**
369
+ * Ranking options for the search.
370
+ */
371
+ ranking: import_v43.z.object({
372
+ ranker: import_v43.z.enum(["auto", "keyword", "semantic"]).optional()
373
+ }).optional(),
356
374
  /**
357
- * Type of search to perform. Defaults to 'auto'.
375
+ * A filter to apply based on file attributes.
358
376
  */
359
- searchType: import_v43.z.enum(["auto", "keyword", "semantic"]).optional()
377
+ filters: filtersSchema.optional()
360
378
  });
361
379
  var fileSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
362
380
  id: "openai.file_search",
@@ -442,8 +460,9 @@ function prepareTools({
442
460
  openaiTools.push({
443
461
  type: "file_search",
444
462
  vector_store_ids: args.vectorStoreIds,
445
- max_results: args.maxResults,
446
- search_type: args.searchType
463
+ max_num_results: args.maxNumResults,
464
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
465
+ filters: args.filters
447
466
  });
448
467
  break;
449
468
  }
@@ -2217,8 +2236,9 @@ function prepareResponsesTools({
2217
2236
  openaiTools.push({
2218
2237
  type: "file_search",
2219
2238
  vector_store_ids: args.vectorStoreIds,
2220
- max_results: args.maxResults,
2221
- search_type: args.searchType
2239
+ max_num_results: args.maxNumResults,
2240
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
2241
+ filters: args.filters
2222
2242
  });
2223
2243
  break;
2224
2244
  }