@ai-sdk/openai 2.0.0-beta.10 → 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.
package/dist/index.mjs CHANGED
@@ -326,6 +326,18 @@ import {
326
326
  // src/tool/file-search.ts
327
327
  import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
328
328
  import { z as z3 } from "zod/v4";
329
+ var comparisonFilterSchema = z3.object({
330
+ key: z3.string(),
331
+ type: z3.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
332
+ value: z3.union([z3.string(), z3.number(), z3.boolean()])
333
+ });
334
+ var compoundFilterSchema = z3.object({
335
+ type: z3.enum(["and", "or"]),
336
+ filters: z3.array(
337
+ z3.union([comparisonFilterSchema, z3.lazy(() => compoundFilterSchema)])
338
+ )
339
+ });
340
+ var filtersSchema = z3.union([comparisonFilterSchema, compoundFilterSchema]);
329
341
  var fileSearchArgsSchema = z3.object({
330
342
  /**
331
343
  * List of vector store IDs to search through. If not provided, searches all available vector stores.
@@ -334,11 +346,17 @@ var fileSearchArgsSchema = z3.object({
334
346
  /**
335
347
  * Maximum number of search results to return. Defaults to 10.
336
348
  */
337
- maxResults: z3.number().optional(),
349
+ maxNumResults: z3.number().optional(),
350
+ /**
351
+ * Ranking options for the search.
352
+ */
353
+ ranking: z3.object({
354
+ ranker: z3.enum(["auto", "keyword", "semantic"]).optional()
355
+ }).optional(),
338
356
  /**
339
- * Type of search to perform. Defaults to 'auto'.
357
+ * A filter to apply based on file attributes.
340
358
  */
341
- searchType: z3.enum(["auto", "keyword", "semantic"]).optional()
359
+ filters: filtersSchema.optional()
342
360
  });
343
361
  var fileSearch = createProviderDefinedToolFactory({
344
362
  id: "openai.file_search",
@@ -424,8 +442,9 @@ function prepareTools({
424
442
  openaiTools2.push({
425
443
  type: "file_search",
426
444
  vector_store_ids: args.vectorStoreIds,
427
- max_results: args.maxResults,
428
- search_type: args.searchType
445
+ max_num_results: args.maxNumResults,
446
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
447
+ filters: args.filters
429
448
  });
430
449
  break;
431
450
  }
@@ -2137,8 +2156,9 @@ function prepareResponsesTools({
2137
2156
  openaiTools2.push({
2138
2157
  type: "file_search",
2139
2158
  vector_store_ids: args.vectorStoreIds,
2140
- max_results: args.maxResults,
2141
- search_type: args.searchType
2159
+ max_num_results: args.maxNumResults,
2160
+ ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
2161
+ filters: args.filters
2142
2162
  });
2143
2163
  break;
2144
2164
  }