@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/CHANGELOG.md +17 -0
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +27 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +27 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/internal/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
*
|
|
375
|
+
* A filter to apply based on file attributes.
|
|
358
376
|
*/
|
|
359
|
-
|
|
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
|
-
|
|
446
|
-
|
|
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
|
-
|
|
2221
|
-
|
|
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
|
}
|