@ai-sdk/gateway 3.0.219 → 3.0.220

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.js CHANGED
@@ -2118,6 +2118,14 @@ var exaSearch = (config = {}) => exaSearchToolFactory(config);
2118
2118
  // src/tool/parallel-search.ts
2119
2119
  var import_provider_utils19 = require("@ai-sdk/provider-utils");
2120
2120
  var import_zod4 = require("zod");
2121
+ var parallelSearchModes = [
2122
+ "turbo",
2123
+ "fast",
2124
+ "basic",
2125
+ "advanced",
2126
+ "one-shot",
2127
+ "agentic"
2128
+ ];
2121
2129
  var parallelSearchInputSchema = (0, import_provider_utils19.lazySchema)(
2122
2130
  () => (0, import_provider_utils19.zodSchema)(
2123
2131
  import_zod4.z.object({
@@ -2125,64 +2133,85 @@ var parallelSearchInputSchema = (0, import_provider_utils19.lazySchema)(
2125
2133
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
2126
2134
  ),
2127
2135
  search_queries: import_zod4.z.array(import_zod4.z.string()).optional().describe(
2128
- "Optional search queries to supplement the objective. Maximum 200 characters per query."
2136
+ "Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."
2129
2137
  ),
2130
- mode: import_zod4.z.enum(["one-shot", "agentic"]).optional().describe(
2131
- 'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
2138
+ mode: import_zod4.z.enum(parallelSearchModes).optional().describe(
2139
+ '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".'
2132
2140
  ),
2133
2141
  max_results: import_zod4.z.number().optional().describe(
2134
2142
  "Maximum number of results to return (1-20). Defaults to 10 if not specified."
2135
2143
  ),
2136
2144
  source_policy: import_zod4.z.object({
2137
2145
  include_domains: import_zod4.z.array(import_zod4.z.string()).optional().describe(
2138
- "Limit results to these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
2146
+ "Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."
2139
2147
  ),
2140
2148
  exclude_domains: import_zod4.z.array(import_zod4.z.string()).optional().describe(
2141
- "Exclude results from these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
2149
+ "Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."
2142
2150
  ),
2143
2151
  after_date: import_zod4.z.string().optional().describe(
2144
- "Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time."
2152
+ "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."
2145
2153
  )
2146
2154
  }).optional().describe(
2147
2155
  "Source policy for controlling which domains to include/exclude and freshness."
2148
2156
  ),
2149
2157
  excerpts: import_zod4.z.object({
2150
2158
  max_chars_per_result: import_zod4.z.number().optional().describe("Maximum characters per result."),
2151
- max_chars_total: import_zod4.z.number().optional().describe("Maximum total characters across all results.")
2159
+ max_chars_total: import_zod4.z.number().optional().describe("Deprecated: use the top-level max_chars_total.")
2152
2160
  }).optional().describe("Excerpt configuration for controlling result length."),
2161
+ max_chars_total: import_zod4.z.number().optional().describe("Maximum total characters across all result excerpts."),
2153
2162
  fetch_policy: import_zod4.z.object({
2154
2163
  max_age_seconds: import_zod4.z.number().optional().describe(
2155
- "Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
2164
+ "Maximum age of cached content in seconds before a live fetch, minimum 600."
2165
+ ),
2166
+ timeout_seconds: import_zod4.z.number().optional().describe(
2167
+ "Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."
2168
+ ),
2169
+ disable_cache_fallback: import_zod4.z.boolean().optional().describe(
2170
+ "Return an error instead of older cached content when a live fetch fails."
2156
2171
  )
2157
- }).optional().describe("Fetch policy for controlling content freshness.")
2172
+ }).optional().describe("Fetch policy for controlling content freshness."),
2173
+ location: import_zod4.z.string().optional().describe(
2174
+ 'ISO 3166-1 alpha-2 country code to localize results, e.g. "us".'
2175
+ )
2158
2176
  })
2159
2177
  )
2160
2178
  );
2161
2179
  var parallelSearchOutputSchema = (0, import_provider_utils19.lazySchema)(
2162
2180
  () => (0, import_provider_utils19.zodSchema)(
2163
2181
  import_zod4.z.union([
2164
- // Success response
2182
+ // Success response (Parallel's response, passed through by the gateway)
2165
2183
  import_zod4.z.object({
2166
- searchId: import_zod4.z.string(),
2184
+ search_id: import_zod4.z.string(),
2167
2185
  results: import_zod4.z.array(
2168
2186
  import_zod4.z.object({
2169
2187
  url: import_zod4.z.string(),
2170
- title: import_zod4.z.string(),
2171
- excerpt: import_zod4.z.string(),
2172
- publishDate: import_zod4.z.string().nullable().optional(),
2173
- relevanceScore: import_zod4.z.number().optional()
2188
+ title: import_zod4.z.string().nullable().optional(),
2189
+ publish_date: import_zod4.z.string().nullable().optional(),
2190
+ excerpts: import_zod4.z.array(import_zod4.z.string())
2174
2191
  })
2175
- )
2192
+ ),
2193
+ warnings: import_zod4.z.array(
2194
+ import_zod4.z.object({
2195
+ type: import_zod4.z.string(),
2196
+ message: import_zod4.z.string(),
2197
+ detail: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).nullable().optional()
2198
+ })
2199
+ ).nullable().optional(),
2200
+ usage: import_zod4.z.array(import_zod4.z.object({ name: import_zod4.z.string(), count: import_zod4.z.number().optional() })).nullable().optional(),
2201
+ session_id: import_zod4.z.string().optional()
2176
2202
  }),
2177
2203
  // Error response
2178
2204
  import_zod4.z.object({
2179
2205
  error: import_zod4.z.enum([
2180
2206
  "api_error",
2207
+ "configuration_error",
2208
+ "execution_error",
2209
+ "gateway_rate_limit",
2210
+ "invalid_input",
2181
2211
  "rate_limit",
2182
2212
  "timeout",
2183
- "invalid_input",
2184
- "configuration_error",
2185
- "unknown"
2213
+ "unknown",
2214
+ "unknown_tool"
2186
2215
  ]),
2187
2216
  statusCode: import_zod4.z.number().optional(),
2188
2217
  message: import_zod4.z.string()
@@ -2551,7 +2580,7 @@ async function getVercelRequestId() {
2551
2580
  }
2552
2581
 
2553
2582
  // src/version.ts
2554
- var VERSION = true ? "3.0.219" : "0.0.0-test";
2583
+ var VERSION = true ? "3.0.220" : "0.0.0-test";
2555
2584
 
2556
2585
  // src/gateway-provider.ts
2557
2586
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";