@ai-sdk/gateway 2.0.171 → 2.0.172
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 +11 -0
- package/dist/index.d.mts +80 -29
- package/dist/index.d.ts +80 -29
- package/dist/index.js +53 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1163,6 +1163,14 @@ var gatewayImageResponseSchema = (0, import_provider_utils10.lazySchema)(
|
|
|
1163
1163
|
// src/tool/parallel-search.ts
|
|
1164
1164
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1165
1165
|
var import_zod = require("zod");
|
|
1166
|
+
var parallelSearchModes = [
|
|
1167
|
+
"turbo",
|
|
1168
|
+
"fast",
|
|
1169
|
+
"basic",
|
|
1170
|
+
"advanced",
|
|
1171
|
+
"one-shot",
|
|
1172
|
+
"agentic"
|
|
1173
|
+
];
|
|
1166
1174
|
var parallelSearchInputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1167
1175
|
() => (0, import_provider_utils11.zodSchema)(
|
|
1168
1176
|
import_zod.z.object({
|
|
@@ -1170,60 +1178,85 @@ var parallelSearchInputSchema = (0, import_provider_utils11.lazySchema)(
|
|
|
1170
1178
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
1171
1179
|
),
|
|
1172
1180
|
search_queries: import_zod.z.array(import_zod.z.string()).optional().describe(
|
|
1173
|
-
"
|
|
1181
|
+
"Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."
|
|
1174
1182
|
),
|
|
1175
|
-
mode: import_zod.z.enum(
|
|
1176
|
-
'
|
|
1183
|
+
mode: import_zod.z.enum(parallelSearchModes).optional().describe(
|
|
1184
|
+
'Search mode: "turbo" and "fast" return quickly with shorter excerpts, "basic" is balanced (default), "advanced" is the most thorough. "turbo" supports English and Japanese only. "one-shot" and "agentic" are deprecated aliases of "basic" and "advanced".'
|
|
1177
1185
|
),
|
|
1178
1186
|
max_results: import_zod.z.number().optional().describe(
|
|
1179
1187
|
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
1180
1188
|
),
|
|
1181
1189
|
source_policy: import_zod.z.object({
|
|
1182
|
-
include_domains: import_zod.z.array(import_zod.z.string()).optional().describe(
|
|
1183
|
-
|
|
1190
|
+
include_domains: import_zod.z.array(import_zod.z.string()).optional().describe(
|
|
1191
|
+
"Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."
|
|
1192
|
+
),
|
|
1193
|
+
exclude_domains: import_zod.z.array(import_zod.z.string()).optional().describe(
|
|
1194
|
+
"Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."
|
|
1195
|
+
),
|
|
1184
1196
|
after_date: import_zod.z.string().optional().describe(
|
|
1185
|
-
"Only include results published after this date
|
|
1197
|
+
"Only include results published on or after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time."
|
|
1186
1198
|
)
|
|
1187
1199
|
}).optional().describe(
|
|
1188
1200
|
"Source policy for controlling which domains to include/exclude and freshness."
|
|
1189
1201
|
),
|
|
1190
1202
|
excerpts: import_zod.z.object({
|
|
1191
1203
|
max_chars_per_result: import_zod.z.number().optional().describe("Maximum characters per result."),
|
|
1192
|
-
max_chars_total: import_zod.z.number().optional().describe("
|
|
1204
|
+
max_chars_total: import_zod.z.number().optional().describe("Deprecated: use the top-level max_chars_total.")
|
|
1193
1205
|
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
1206
|
+
max_chars_total: import_zod.z.number().optional().describe("Maximum total characters across all result excerpts."),
|
|
1194
1207
|
fetch_policy: import_zod.z.object({
|
|
1195
1208
|
max_age_seconds: import_zod.z.number().optional().describe(
|
|
1196
|
-
"Maximum age
|
|
1209
|
+
"Maximum age of cached content in seconds before a live fetch, minimum 600."
|
|
1210
|
+
),
|
|
1211
|
+
timeout_seconds: import_zod.z.number().optional().describe(
|
|
1212
|
+
"Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."
|
|
1213
|
+
),
|
|
1214
|
+
disable_cache_fallback: import_zod.z.boolean().optional().describe(
|
|
1215
|
+
"Return an error instead of older cached content when a live fetch fails."
|
|
1197
1216
|
)
|
|
1198
|
-
}).optional().describe("Fetch policy for controlling content freshness.")
|
|
1217
|
+
}).optional().describe("Fetch policy for controlling content freshness."),
|
|
1218
|
+
location: import_zod.z.string().optional().describe(
|
|
1219
|
+
'ISO 3166-1 alpha-2 country code to localize results, e.g. "us".'
|
|
1220
|
+
)
|
|
1199
1221
|
})
|
|
1200
1222
|
)
|
|
1201
1223
|
);
|
|
1202
1224
|
var parallelSearchOutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1203
1225
|
() => (0, import_provider_utils11.zodSchema)(
|
|
1204
1226
|
import_zod.z.union([
|
|
1205
|
-
// Success response
|
|
1227
|
+
// Success response (Parallel's response, passed through by the gateway)
|
|
1206
1228
|
import_zod.z.object({
|
|
1207
|
-
|
|
1229
|
+
search_id: import_zod.z.string(),
|
|
1208
1230
|
results: import_zod.z.array(
|
|
1209
1231
|
import_zod.z.object({
|
|
1210
1232
|
url: import_zod.z.string(),
|
|
1211
|
-
title: import_zod.z.string(),
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
relevanceScore: import_zod.z.number().optional()
|
|
1233
|
+
title: import_zod.z.string().nullable().optional(),
|
|
1234
|
+
publish_date: import_zod.z.string().nullable().optional(),
|
|
1235
|
+
excerpts: import_zod.z.array(import_zod.z.string())
|
|
1215
1236
|
})
|
|
1216
|
-
)
|
|
1237
|
+
),
|
|
1238
|
+
warnings: import_zod.z.array(
|
|
1239
|
+
import_zod.z.object({
|
|
1240
|
+
type: import_zod.z.string(),
|
|
1241
|
+
message: import_zod.z.string(),
|
|
1242
|
+
detail: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).nullable().optional()
|
|
1243
|
+
})
|
|
1244
|
+
).nullable().optional(),
|
|
1245
|
+
usage: import_zod.z.array(import_zod.z.object({ name: import_zod.z.string(), count: import_zod.z.number().optional() })).nullable().optional(),
|
|
1246
|
+
session_id: import_zod.z.string().optional()
|
|
1217
1247
|
}),
|
|
1218
1248
|
// Error response
|
|
1219
1249
|
import_zod.z.object({
|
|
1220
1250
|
error: import_zod.z.enum([
|
|
1221
1251
|
"api_error",
|
|
1252
|
+
"configuration_error",
|
|
1253
|
+
"execution_error",
|
|
1254
|
+
"gateway_rate_limit",
|
|
1255
|
+
"invalid_input",
|
|
1222
1256
|
"rate_limit",
|
|
1223
1257
|
"timeout",
|
|
1224
|
-
"
|
|
1225
|
-
"
|
|
1226
|
-
"unknown"
|
|
1258
|
+
"unknown",
|
|
1259
|
+
"unknown_tool"
|
|
1227
1260
|
]),
|
|
1228
1261
|
statusCode: import_zod.z.number().optional(),
|
|
1229
1262
|
message: import_zod.z.string()
|
|
@@ -1353,7 +1386,7 @@ async function getVercelRequestId() {
|
|
|
1353
1386
|
}
|
|
1354
1387
|
|
|
1355
1388
|
// src/version.ts
|
|
1356
|
-
var VERSION = true ? "2.0.
|
|
1389
|
+
var VERSION = true ? "2.0.172" : "0.0.0-test";
|
|
1357
1390
|
|
|
1358
1391
|
// src/gateway-provider.ts
|
|
1359
1392
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|