@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/dist/index.mjs CHANGED
@@ -1193,6 +1193,14 @@ import {
1193
1193
  zodSchema as zodSchema10
1194
1194
  } from "@ai-sdk/provider-utils";
1195
1195
  import { z as z11 } from "zod";
1196
+ var parallelSearchModes = [
1197
+ "turbo",
1198
+ "fast",
1199
+ "basic",
1200
+ "advanced",
1201
+ "one-shot",
1202
+ "agentic"
1203
+ ];
1196
1204
  var parallelSearchInputSchema = lazySchema4(
1197
1205
  () => zodSchema10(
1198
1206
  z11.object({
@@ -1200,60 +1208,85 @@ var parallelSearchInputSchema = lazySchema4(
1200
1208
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
1201
1209
  ),
1202
1210
  search_queries: z11.array(z11.string()).optional().describe(
1203
- "Optional search queries to supplement the objective. Maximum 200 characters per query."
1211
+ "Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."
1204
1212
  ),
1205
- mode: z11.enum(["one-shot", "agentic"]).optional().describe(
1206
- 'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
1213
+ mode: z11.enum(parallelSearchModes).optional().describe(
1214
+ '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".'
1207
1215
  ),
1208
1216
  max_results: z11.number().optional().describe(
1209
1217
  "Maximum number of results to return (1-20). Defaults to 10 if not specified."
1210
1218
  ),
1211
1219
  source_policy: z11.object({
1212
- include_domains: z11.array(z11.string()).optional().describe("List of domains to include in search results."),
1213
- exclude_domains: z11.array(z11.string()).optional().describe("List of domains to exclude from search results."),
1220
+ include_domains: z11.array(z11.string()).optional().describe(
1221
+ "Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."
1222
+ ),
1223
+ exclude_domains: z11.array(z11.string()).optional().describe(
1224
+ "Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."
1225
+ ),
1214
1226
  after_date: z11.string().optional().describe(
1215
- "Only include results published after this date (ISO 8601 format)."
1227
+ "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."
1216
1228
  )
1217
1229
  }).optional().describe(
1218
1230
  "Source policy for controlling which domains to include/exclude and freshness."
1219
1231
  ),
1220
1232
  excerpts: z11.object({
1221
1233
  max_chars_per_result: z11.number().optional().describe("Maximum characters per result."),
1222
- max_chars_total: z11.number().optional().describe("Maximum total characters across all results.")
1234
+ max_chars_total: z11.number().optional().describe("Deprecated: use the top-level max_chars_total.")
1223
1235
  }).optional().describe("Excerpt configuration for controlling result length."),
1236
+ max_chars_total: z11.number().optional().describe("Maximum total characters across all result excerpts."),
1224
1237
  fetch_policy: z11.object({
1225
1238
  max_age_seconds: z11.number().optional().describe(
1226
- "Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
1239
+ "Maximum age of cached content in seconds before a live fetch, minimum 600."
1240
+ ),
1241
+ timeout_seconds: z11.number().optional().describe(
1242
+ "Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."
1243
+ ),
1244
+ disable_cache_fallback: z11.boolean().optional().describe(
1245
+ "Return an error instead of older cached content when a live fetch fails."
1227
1246
  )
1228
- }).optional().describe("Fetch policy for controlling content freshness.")
1247
+ }).optional().describe("Fetch policy for controlling content freshness."),
1248
+ location: z11.string().optional().describe(
1249
+ 'ISO 3166-1 alpha-2 country code to localize results, e.g. "us".'
1250
+ )
1229
1251
  })
1230
1252
  )
1231
1253
  );
1232
1254
  var parallelSearchOutputSchema = lazySchema4(
1233
1255
  () => zodSchema10(
1234
1256
  z11.union([
1235
- // Success response
1257
+ // Success response (Parallel's response, passed through by the gateway)
1236
1258
  z11.object({
1237
- searchId: z11.string(),
1259
+ search_id: z11.string(),
1238
1260
  results: z11.array(
1239
1261
  z11.object({
1240
1262
  url: z11.string(),
1241
- title: z11.string(),
1242
- excerpt: z11.string(),
1243
- publishDate: z11.string().nullable().optional(),
1244
- relevanceScore: z11.number().optional()
1263
+ title: z11.string().nullable().optional(),
1264
+ publish_date: z11.string().nullable().optional(),
1265
+ excerpts: z11.array(z11.string())
1245
1266
  })
1246
- )
1267
+ ),
1268
+ warnings: z11.array(
1269
+ z11.object({
1270
+ type: z11.string(),
1271
+ message: z11.string(),
1272
+ detail: z11.record(z11.string(), z11.unknown()).nullable().optional()
1273
+ })
1274
+ ).nullable().optional(),
1275
+ usage: z11.array(z11.object({ name: z11.string(), count: z11.number().optional() })).nullable().optional(),
1276
+ session_id: z11.string().optional()
1247
1277
  }),
1248
1278
  // Error response
1249
1279
  z11.object({
1250
1280
  error: z11.enum([
1251
1281
  "api_error",
1282
+ "configuration_error",
1283
+ "execution_error",
1284
+ "gateway_rate_limit",
1285
+ "invalid_input",
1252
1286
  "rate_limit",
1253
1287
  "timeout",
1254
- "invalid_input",
1255
- "configuration_error",
1256
- "unknown"
1288
+ "unknown",
1289
+ "unknown_tool"
1257
1290
  ]),
1258
1291
  statusCode: z11.number().optional(),
1259
1292
  message: z11.string()
@@ -1387,7 +1420,7 @@ async function getVercelRequestId() {
1387
1420
  }
1388
1421
 
1389
1422
  // src/version.ts
1390
- var VERSION = true ? "2.0.171" : "0.0.0-test";
1423
+ var VERSION = true ? "2.0.172" : "0.0.0-test";
1391
1424
 
1392
1425
  // src/gateway-provider.ts
1393
1426
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";