@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.
@@ -320,6 +320,18 @@ import {
320
320
  // src/tool/file-search.ts
321
321
  import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
322
322
  import { z as z3 } from "zod/v4";
323
+ var comparisonFilterSchema = z3.object({
324
+ key: z3.string(),
325
+ type: z3.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
326
+ value: z3.union([z3.string(), z3.number(), z3.boolean()])
327
+ });
328
+ var compoundFilterSchema = z3.object({
329
+ type: z3.enum(["and", "or"]),
330
+ filters: z3.array(
331
+ z3.union([comparisonFilterSchema, z3.lazy(() => compoundFilterSchema)])
332
+ )
333
+ });
334
+ var filtersSchema = z3.union([comparisonFilterSchema, compoundFilterSchema]);
323
335
  var fileSearchArgsSchema = z3.object({
324
336
  /**
325
337
  * List of vector store IDs to search through. If not provided, searches all available vector stores.
@@ -328,11 +340,17 @@ var fileSearchArgsSchema = z3.object({
328
340
  /**
329
341
  * Maximum number of search results to return. Defaults to 10.
330
342
  */
331
- maxResults: z3.number().optional(),
343
+ maxNumResults: z3.number().optional(),
344
+ /**
345
+ * Ranking options for the search.
346
+ */
347
+ ranking: z3.object({
348
+ ranker: z3.enum(["auto", "keyword", "semantic"]).optional()
349
+ }).optional(),
332
350
  /**
333
- * Type of search to perform. Defaults to 'auto'.
351
+ * A filter to apply based on file attributes.
334
352
  */
335
- searchType: z3.enum(["auto", "keyword", "semantic"]).optional()
353
+ filters: filtersSchema.optional()
336
354
  });
337
355
  var fileSearch = createProviderDefinedToolFactory({
338
356
  id: "openai.file_search",
@@ -418,8 +436,9 @@ function prepareTools({
418
436
  openaiTools.push({
419
437
  type: "file_search",
420
438
  vector_store_ids: args.vectorStoreIds,
421
- max_results: args.maxResults,
422
- search_type: args.searchType
439
+ max_num_results: args.maxNumResults,
440
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
441
+ filters: args.filters
423
442
  });
424
443
  break;
425
444
  }
@@ -2237,8 +2256,9 @@ function prepareResponsesTools({
2237
2256
  openaiTools.push({
2238
2257
  type: "file_search",
2239
2258
  vector_store_ids: args.vectorStoreIds,
2240
- max_results: args.maxResults,
2241
- search_type: args.searchType
2259
+ max_num_results: args.maxNumResults,
2260
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
2261
+ filters: args.filters
2242
2262
  });
2243
2263
  break;
2244
2264
  }