@ai-sdk/gateway 3.0.226 → 3.0.227

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
@@ -496,6 +496,9 @@ function isTimeoutError(error) {
496
496
  }
497
497
  async function asGatewayError(error, authMethod) {
498
498
  var _a11;
499
+ if ((error instanceof Error || typeof DOMException === "function" && error instanceof DOMException) && (error.name === "AbortError" || error.name === "TimeoutError")) {
500
+ throw error;
501
+ }
499
502
  if (GatewayError.isInstance(error)) {
500
503
  return error;
501
504
  }
@@ -2060,22 +2063,127 @@ var browserbaseSearchToolFactory = createProviderToolFactoryWithOutputSchema2({
2060
2063
  });
2061
2064
  var browserbaseSearch = (config = {}) => browserbaseSearchToolFactory(config);
2062
2065
 
2063
- // src/tool/exa-search.ts
2066
+ // src/tool/deepseek-fetch.ts
2064
2067
  import {
2065
2068
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2066
2069
  lazySchema as lazySchema16,
2067
2070
  zodSchema as zodSchema16
2068
2071
  } from "@ai-sdk/provider-utils";
2072
+ import { z as z18 } from "zod";
2073
+
2074
+ // src/tool/gateway-tool-error.ts
2069
2075
  import { z as z17 } from "zod";
2070
- var exaSearchInputSchema = lazySchema16(
2076
+ var gatewayToolErrorSchema = () => z17.object({
2077
+ error: z17.enum([
2078
+ "api_error",
2079
+ "configuration_error",
2080
+ "execution_error",
2081
+ "gateway_rate_limit",
2082
+ "invalid_input",
2083
+ "rate_limit",
2084
+ "timeout",
2085
+ "unknown",
2086
+ "unknown_tool"
2087
+ ]),
2088
+ message: z17.string(),
2089
+ statusCode: z17.number().optional(),
2090
+ retryAfter: z17.string().optional(),
2091
+ statusText: z17.string().optional()
2092
+ }).passthrough();
2093
+
2094
+ // src/tool/deepseek-fetch.ts
2095
+ var deepseekFetchInputSchema = lazySchema16(
2096
+ () => zodSchema16(
2097
+ z18.object({
2098
+ url: z18.string().describe(
2099
+ "URL to fetch, at most 8192 characters; HTTP(S) only, without a username or password."
2100
+ )
2101
+ })
2102
+ )
2103
+ );
2104
+ var deepseekFetchOutputSchema = lazySchema16(
2071
2105
  () => zodSchema16(
2072
- z17.object({
2073
- query: z17.string().describe("Natural-language web search query. This is required."),
2074
- type: z17.enum(["auto", "fast", "instant"]).optional().describe(
2106
+ z18.union([
2107
+ z18.object({
2108
+ title: z18.string().nullish(),
2109
+ content: z18.string()
2110
+ }).passthrough(),
2111
+ gatewayToolErrorSchema()
2112
+ ])
2113
+ )
2114
+ );
2115
+ var deepseekFetchToolFactory = createProviderToolFactoryWithOutputSchema3({
2116
+ id: "gateway.deepseek_fetch",
2117
+ inputSchema: deepseekFetchInputSchema,
2118
+ outputSchema: deepseekFetchOutputSchema
2119
+ });
2120
+ var deepseekFetch = (config = {}) => deepseekFetchToolFactory(config);
2121
+
2122
+ // src/tool/deepseek-search.ts
2123
+ import {
2124
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
2125
+ lazySchema as lazySchema17,
2126
+ zodSchema as zodSchema17
2127
+ } from "@ai-sdk/provider-utils";
2128
+ import { z as z19 } from "zod";
2129
+ var deepseekSearchInputSchema = lazySchema17(
2130
+ () => zodSchema17(
2131
+ z19.object({
2132
+ query: z19.string().describe(
2133
+ "Web search query, 1 to 128 Unicode characters. Supports site:, -site:, lang:, after:, before:, and quoted phrases."
2134
+ ),
2135
+ count: z19.number().int().optional().describe("Number of results, 1 to 50 (default: 10)."),
2136
+ need_content: z19.boolean().optional().describe("Include available page content (default: false)."),
2137
+ ori_question: z19.string().nullable().optional().describe("Original user question, 1 to 128 Unicode characters.")
2138
+ })
2139
+ )
2140
+ );
2141
+ var deepseekSearchOutputSchema = lazySchema17(
2142
+ () => zodSchema17(
2143
+ z19.union([
2144
+ z19.object({
2145
+ results: z19.array(
2146
+ z19.object({
2147
+ authority: z19.number().nullish(),
2148
+ content: z19.string().nullish(),
2149
+ date: z19.string().nullish(),
2150
+ rerank_score: z19.number().nullish(),
2151
+ site_icon: z19.string().nullish(),
2152
+ site_name: z19.string().nullish(),
2153
+ snippet: z19.string().nullish(),
2154
+ summary: z19.string().nullish(),
2155
+ title: z19.string().nullish(),
2156
+ url: z19.string().nullish()
2157
+ }).passthrough()
2158
+ )
2159
+ }).passthrough(),
2160
+ gatewayToolErrorSchema()
2161
+ ])
2162
+ )
2163
+ );
2164
+ var deepseekSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
2165
+ id: "gateway.deepseek_search",
2166
+ inputSchema: deepseekSearchInputSchema,
2167
+ outputSchema: deepseekSearchOutputSchema
2168
+ });
2169
+ var deepseekSearch = (config = {}) => deepseekSearchToolFactory(config);
2170
+
2171
+ // src/tool/exa-search.ts
2172
+ import {
2173
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
2174
+ lazySchema as lazySchema18,
2175
+ zodSchema as zodSchema18
2176
+ } from "@ai-sdk/provider-utils";
2177
+ import { z as z20 } from "zod";
2178
+ var exaSearchInputSchema = lazySchema18(
2179
+ () => zodSchema18(
2180
+ z20.object({
2181
+ query: z20.string().describe("Natural-language web search query. This is required."),
2182
+ type: z20.enum(["auto", "fast", "instant"]).optional().describe(
2075
2183
  "Search method. Use auto for the default balance of speed and quality."
2076
2184
  ),
2077
- num_results: z17.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
2078
- category: z17.enum([
2185
+ num_results: z20.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
2186
+ category: z20.enum([
2079
2187
  "company",
2080
2188
  "people",
2081
2189
  "research paper",
@@ -2083,20 +2191,20 @@ var exaSearchInputSchema = lazySchema16(
2083
2191
  "personal site",
2084
2192
  "financial report"
2085
2193
  ]).optional().describe("Optional content category to focus results."),
2086
- user_location: z17.string().optional().describe("Two-letter ISO country code such as 'US'."),
2087
- include_domains: z17.array(z17.string()).optional().describe("Only return results from these domains."),
2088
- exclude_domains: z17.array(z17.string()).optional().describe("Exclude results from these domains."),
2089
- start_published_date: z17.string().optional().describe("Only return links published after this ISO 8601 date."),
2090
- end_published_date: z17.string().optional().describe("Only return links published before this ISO 8601 date."),
2091
- contents: z17.object({
2092
- text: z17.union([
2093
- z17.boolean(),
2094
- z17.object({
2095
- max_characters: z17.number().optional(),
2096
- include_html_tags: z17.boolean().optional(),
2097
- verbosity: z17.enum(["compact", "standard", "full"]).optional(),
2098
- include_sections: z17.array(
2099
- z17.enum([
2194
+ user_location: z20.string().optional().describe("Two-letter ISO country code such as 'US'."),
2195
+ include_domains: z20.array(z20.string()).optional().describe("Only return results from these domains."),
2196
+ exclude_domains: z20.array(z20.string()).optional().describe("Exclude results from these domains."),
2197
+ start_published_date: z20.string().optional().describe("Only return links published after this ISO 8601 date."),
2198
+ end_published_date: z20.string().optional().describe("Only return links published before this ISO 8601 date."),
2199
+ contents: z20.object({
2200
+ text: z20.union([
2201
+ z20.boolean(),
2202
+ z20.object({
2203
+ max_characters: z20.number().optional(),
2204
+ include_html_tags: z20.boolean().optional(),
2205
+ verbosity: z20.enum(["compact", "standard", "full"]).optional(),
2206
+ include_sections: z20.array(
2207
+ z20.enum([
2100
2208
  "header",
2101
2209
  "navigation",
2102
2210
  "banner",
@@ -2106,8 +2214,8 @@ var exaSearchInputSchema = lazySchema16(
2106
2214
  "metadata"
2107
2215
  ])
2108
2216
  ).optional(),
2109
- exclude_sections: z17.array(
2110
- z17.enum([
2217
+ exclude_sections: z20.array(
2218
+ z20.enum([
2111
2219
  "header",
2112
2220
  "navigation",
2113
2221
  "banner",
@@ -2119,59 +2227,59 @@ var exaSearchInputSchema = lazySchema16(
2119
2227
  ).optional()
2120
2228
  })
2121
2229
  ]).optional(),
2122
- highlights: z17.union([
2123
- z17.boolean(),
2124
- z17.object({
2125
- query: z17.string().optional(),
2126
- max_characters: z17.number().optional()
2230
+ highlights: z20.union([
2231
+ z20.boolean(),
2232
+ z20.object({
2233
+ query: z20.string().optional(),
2234
+ max_characters: z20.number().optional()
2127
2235
  })
2128
2236
  ]).optional(),
2129
- max_age_hours: z17.number().optional(),
2130
- livecrawl_timeout: z17.number().optional(),
2131
- subpages: z17.number().optional(),
2132
- subpage_target: z17.union([z17.string(), z17.array(z17.string())]).optional(),
2133
- extras: z17.object({
2134
- links: z17.number().optional(),
2135
- image_links: z17.number().optional()
2237
+ max_age_hours: z20.number().optional(),
2238
+ livecrawl_timeout: z20.number().optional(),
2239
+ subpages: z20.number().optional(),
2240
+ subpage_target: z20.union([z20.string(), z20.array(z20.string())]).optional(),
2241
+ extras: z20.object({
2242
+ links: z20.number().optional(),
2243
+ image_links: z20.number().optional()
2136
2244
  }).optional()
2137
2245
  }).optional().describe("Controls extracted page content and freshness.")
2138
2246
  })
2139
2247
  )
2140
2248
  );
2141
- var exaSearchOutputSchema = lazySchema16(
2142
- () => zodSchema16(
2143
- z17.union([
2144
- z17.object({
2145
- requestId: z17.string(),
2146
- searchType: z17.string().optional(),
2147
- resolvedSearchType: z17.string().optional(),
2148
- results: z17.array(
2149
- z17.object({
2150
- title: z17.string(),
2151
- url: z17.string(),
2152
- id: z17.string(),
2153
- publishedDate: z17.string().nullable().optional(),
2154
- author: z17.string().nullable().optional(),
2155
- image: z17.string().nullable().optional(),
2156
- favicon: z17.string().nullable().optional(),
2157
- text: z17.string().optional(),
2158
- highlights: z17.array(z17.string()).optional(),
2159
- highlightScores: z17.array(z17.number()).optional(),
2160
- summary: z17.string().optional(),
2161
- subpages: z17.array(z17.any()).optional(),
2162
- extras: z17.object({
2163
- links: z17.array(z17.string()).optional(),
2164
- imageLinks: z17.array(z17.string()).optional()
2249
+ var exaSearchOutputSchema = lazySchema18(
2250
+ () => zodSchema18(
2251
+ z20.union([
2252
+ z20.object({
2253
+ requestId: z20.string(),
2254
+ searchType: z20.string().optional(),
2255
+ resolvedSearchType: z20.string().optional(),
2256
+ results: z20.array(
2257
+ z20.object({
2258
+ title: z20.string(),
2259
+ url: z20.string(),
2260
+ id: z20.string(),
2261
+ publishedDate: z20.string().nullable().optional(),
2262
+ author: z20.string().nullable().optional(),
2263
+ image: z20.string().nullable().optional(),
2264
+ favicon: z20.string().nullable().optional(),
2265
+ text: z20.string().optional(),
2266
+ highlights: z20.array(z20.string()).optional(),
2267
+ highlightScores: z20.array(z20.number()).optional(),
2268
+ summary: z20.string().optional(),
2269
+ subpages: z20.array(z20.any()).optional(),
2270
+ extras: z20.object({
2271
+ links: z20.array(z20.string()).optional(),
2272
+ imageLinks: z20.array(z20.string()).optional()
2165
2273
  }).optional()
2166
2274
  })
2167
2275
  ),
2168
- costDollars: z17.object({
2169
- total: z17.number().optional(),
2170
- search: z17.record(z17.number()).optional()
2276
+ costDollars: z20.object({
2277
+ total: z20.number().optional(),
2278
+ search: z20.record(z20.number()).optional()
2171
2279
  }).optional()
2172
2280
  }),
2173
- z17.object({
2174
- error: z17.enum([
2281
+ z20.object({
2282
+ error: z20.enum([
2175
2283
  "api_error",
2176
2284
  "rate_limit",
2177
2285
  "timeout",
@@ -2180,13 +2288,13 @@ var exaSearchOutputSchema = lazySchema16(
2180
2288
  "execution_error",
2181
2289
  "unknown"
2182
2290
  ]),
2183
- statusCode: z17.number().optional(),
2184
- message: z17.string()
2291
+ statusCode: z20.number().optional(),
2292
+ message: z20.string()
2185
2293
  })
2186
2294
  ])
2187
2295
  )
2188
2296
  );
2189
- var exaSearchToolFactory = createProviderToolFactoryWithOutputSchema3({
2297
+ var exaSearchToolFactory = createProviderToolFactoryWithOutputSchema5({
2190
2298
  id: "gateway.exa_search",
2191
2299
  inputSchema: exaSearchInputSchema,
2192
2300
  outputSchema: exaSearchOutputSchema
@@ -2195,11 +2303,11 @@ var exaSearch = (config = {}) => exaSearchToolFactory(config);
2195
2303
 
2196
2304
  // src/tool/parallel-search.ts
2197
2305
  import {
2198
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
2199
- lazySchema as lazySchema17,
2200
- zodSchema as zodSchema17
2306
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
2307
+ lazySchema as lazySchema19,
2308
+ zodSchema as zodSchema19
2201
2309
  } from "@ai-sdk/provider-utils";
2202
- import { z as z18 } from "zod";
2310
+ import { z as z21 } from "zod";
2203
2311
  var parallelSearchModes = [
2204
2312
  "turbo",
2205
2313
  "fast",
@@ -2208,100 +2316,86 @@ var parallelSearchModes = [
2208
2316
  "one-shot",
2209
2317
  "agentic"
2210
2318
  ];
2211
- var parallelSearchInputSchema = lazySchema17(
2212
- () => zodSchema17(
2213
- z18.object({
2214
- objective: z18.string().describe(
2319
+ var parallelSearchInputSchema = lazySchema19(
2320
+ () => zodSchema19(
2321
+ z21.object({
2322
+ objective: z21.string().describe(
2215
2323
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
2216
2324
  ),
2217
- search_queries: z18.array(z18.string()).optional().describe(
2325
+ search_queries: z21.array(z21.string()).optional().describe(
2218
2326
  "Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."
2219
2327
  ),
2220
- mode: z18.enum(parallelSearchModes).optional().describe(
2328
+ mode: z21.enum(parallelSearchModes).optional().describe(
2221
2329
  '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".'
2222
2330
  ),
2223
- max_results: z18.number().optional().describe(
2331
+ max_results: z21.number().optional().describe(
2224
2332
  "Maximum number of results to return (1-20). Defaults to 10 if not specified."
2225
2333
  ),
2226
- source_policy: z18.object({
2227
- include_domains: z18.array(z18.string()).optional().describe(
2334
+ source_policy: z21.object({
2335
+ include_domains: z21.array(z21.string()).optional().describe(
2228
2336
  "Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."
2229
2337
  ),
2230
- exclude_domains: z18.array(z18.string()).optional().describe(
2338
+ exclude_domains: z21.array(z21.string()).optional().describe(
2231
2339
  "Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."
2232
2340
  ),
2233
- after_date: z18.string().optional().describe(
2341
+ after_date: z21.string().optional().describe(
2234
2342
  "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."
2235
2343
  )
2236
2344
  }).optional().describe(
2237
2345
  "Source policy for controlling which domains to include/exclude and freshness."
2238
2346
  ),
2239
- excerpts: z18.object({
2240
- max_chars_per_result: z18.number().optional().describe("Maximum characters per result."),
2241
- max_chars_total: z18.number().optional().describe("Deprecated: use the top-level max_chars_total.")
2347
+ excerpts: z21.object({
2348
+ max_chars_per_result: z21.number().optional().describe("Maximum characters per result."),
2349
+ max_chars_total: z21.number().optional().describe("Deprecated: use the top-level max_chars_total.")
2242
2350
  }).optional().describe("Excerpt configuration for controlling result length."),
2243
- max_chars_total: z18.number().optional().describe("Maximum total characters across all result excerpts."),
2244
- fetch_policy: z18.object({
2245
- max_age_seconds: z18.number().optional().describe(
2351
+ max_chars_total: z21.number().optional().describe("Maximum total characters across all result excerpts."),
2352
+ fetch_policy: z21.object({
2353
+ max_age_seconds: z21.number().optional().describe(
2246
2354
  "Maximum age of cached content in seconds before a live fetch, minimum 600."
2247
2355
  ),
2248
- timeout_seconds: z18.number().optional().describe(
2356
+ timeout_seconds: z21.number().optional().describe(
2249
2357
  "Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."
2250
2358
  ),
2251
- disable_cache_fallback: z18.boolean().optional().describe(
2359
+ disable_cache_fallback: z21.boolean().optional().describe(
2252
2360
  "Return an error instead of older cached content when a live fetch fails."
2253
2361
  )
2254
2362
  }).optional().describe("Fetch policy for controlling content freshness."),
2255
- location: z18.string().optional().describe(
2363
+ location: z21.string().optional().describe(
2256
2364
  'ISO 3166-1 alpha-2 country code to localize results, e.g. "us".'
2257
2365
  )
2258
2366
  })
2259
2367
  )
2260
2368
  );
2261
- var parallelSearchOutputSchema = lazySchema17(
2262
- () => zodSchema17(
2263
- z18.union([
2369
+ var parallelSearchOutputSchema = lazySchema19(
2370
+ () => zodSchema19(
2371
+ z21.union([
2264
2372
  // Success response (Parallel's response, passed through by the gateway)
2265
- z18.object({
2266
- search_id: z18.string(),
2267
- results: z18.array(
2268
- z18.object({
2269
- url: z18.string(),
2270
- title: z18.string().nullable().optional(),
2271
- publish_date: z18.string().nullable().optional(),
2272
- excerpts: z18.array(z18.string())
2373
+ z21.object({
2374
+ search_id: z21.string(),
2375
+ results: z21.array(
2376
+ z21.object({
2377
+ url: z21.string(),
2378
+ title: z21.string().nullable().optional(),
2379
+ publish_date: z21.string().nullable().optional(),
2380
+ excerpts: z21.array(z21.string())
2273
2381
  })
2274
2382
  ),
2275
- warnings: z18.array(
2276
- z18.object({
2277
- type: z18.string(),
2278
- message: z18.string(),
2279
- detail: z18.record(z18.string(), z18.unknown()).nullable().optional()
2383
+ warnings: z21.array(
2384
+ z21.object({
2385
+ type: z21.string(),
2386
+ message: z21.string(),
2387
+ detail: z21.record(z21.string(), z21.unknown()).nullable().optional()
2280
2388
  })
2281
2389
  ).nullable().optional(),
2282
- usage: z18.array(z18.object({ name: z18.string(), count: z18.number().optional() })).nullable().optional(),
2283
- session_id: z18.string().optional()
2390
+ usage: z21.array(z21.object({ name: z21.string(), count: z21.number().optional() })).nullable().optional(),
2391
+ session_id: z21.string().optional()
2284
2392
  }),
2285
2393
  // Error response
2286
- z18.object({
2287
- error: z18.enum([
2288
- "api_error",
2289
- "configuration_error",
2290
- "execution_error",
2291
- "gateway_rate_limit",
2292
- "invalid_input",
2293
- "rate_limit",
2294
- "timeout",
2295
- "unknown",
2296
- "unknown_tool"
2297
- ]),
2298
- statusCode: z18.number().optional(),
2299
- message: z18.string()
2300
- })
2394
+ gatewayToolErrorSchema()
2301
2395
  ])
2302
2396
  )
2303
2397
  );
2304
- var parallelSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
2398
+ var parallelSearchToolFactory = createProviderToolFactoryWithOutputSchema6({
2305
2399
  id: "gateway.parallel_search",
2306
2400
  inputSchema: parallelSearchInputSchema,
2307
2401
  outputSchema: parallelSearchOutputSchema
@@ -2310,85 +2404,85 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
2310
2404
 
2311
2405
  // src/tool/perplexity-search.ts
2312
2406
  import {
2313
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
2314
- lazySchema as lazySchema18,
2315
- zodSchema as zodSchema18
2407
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
2408
+ lazySchema as lazySchema20,
2409
+ zodSchema as zodSchema20
2316
2410
  } from "@ai-sdk/provider-utils";
2317
- import { z as z19 } from "zod";
2318
- var perplexitySearchInputSchema = lazySchema18(
2319
- () => zodSchema18(
2320
- z19.object({
2321
- query: z19.union([z19.string(), z19.array(z19.string())]).describe(
2411
+ import { z as z22 } from "zod";
2412
+ var perplexitySearchInputSchema = lazySchema20(
2413
+ () => zodSchema20(
2414
+ z22.object({
2415
+ query: z22.union([z22.string(), z22.array(z22.string())]).describe(
2322
2416
  "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
2323
2417
  ),
2324
- max_results: z19.number().optional().describe(
2418
+ max_results: z22.number().optional().describe(
2325
2419
  "Maximum number of search results to return (1-20, default: 10)"
2326
2420
  ),
2327
- max_tokens_per_page: z19.number().optional().describe(
2421
+ max_tokens_per_page: z22.number().optional().describe(
2328
2422
  "Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
2329
2423
  ),
2330
- max_tokens: z19.number().optional().describe(
2424
+ max_tokens: z22.number().optional().describe(
2331
2425
  "Maximum total tokens across all search results (default: 25000, max: 1000000)"
2332
2426
  ),
2333
- country: z19.string().optional().describe(
2427
+ country: z22.string().optional().describe(
2334
2428
  "Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
2335
2429
  ),
2336
- search_domain_filter: z19.array(z19.string()).optional().describe(
2430
+ search_domain_filter: z22.array(z22.string()).optional().describe(
2337
2431
  "List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
2338
2432
  ),
2339
- search_language_filter: z19.array(z19.string()).optional().describe(
2433
+ search_language_filter: z22.array(z22.string()).optional().describe(
2340
2434
  "List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
2341
2435
  ),
2342
- search_after_date: z19.string().optional().describe(
2436
+ search_after_date: z22.string().optional().describe(
2343
2437
  "Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
2344
2438
  ),
2345
- search_before_date: z19.string().optional().describe(
2439
+ search_before_date: z22.string().optional().describe(
2346
2440
  "Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
2347
2441
  ),
2348
- last_updated_after_filter: z19.string().optional().describe(
2442
+ last_updated_after_filter: z22.string().optional().describe(
2349
2443
  "Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
2350
2444
  ),
2351
- last_updated_before_filter: z19.string().optional().describe(
2445
+ last_updated_before_filter: z22.string().optional().describe(
2352
2446
  "Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
2353
2447
  ),
2354
- search_recency_filter: z19.enum(["day", "week", "month", "year"]).optional().describe(
2448
+ search_recency_filter: z22.enum(["day", "week", "month", "year"]).optional().describe(
2355
2449
  "Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
2356
2450
  )
2357
2451
  })
2358
2452
  )
2359
2453
  );
2360
- var perplexitySearchOutputSchema = lazySchema18(
2361
- () => zodSchema18(
2362
- z19.union([
2454
+ var perplexitySearchOutputSchema = lazySchema20(
2455
+ () => zodSchema20(
2456
+ z22.union([
2363
2457
  // Success response
2364
- z19.object({
2365
- results: z19.array(
2366
- z19.object({
2367
- title: z19.string(),
2368
- url: z19.string(),
2369
- snippet: z19.string(),
2370
- date: z19.string().optional(),
2371
- lastUpdated: z19.string().optional()
2458
+ z22.object({
2459
+ results: z22.array(
2460
+ z22.object({
2461
+ title: z22.string(),
2462
+ url: z22.string(),
2463
+ snippet: z22.string(),
2464
+ date: z22.string().optional(),
2465
+ lastUpdated: z22.string().optional()
2372
2466
  })
2373
2467
  ),
2374
- id: z19.string()
2468
+ id: z22.string()
2375
2469
  }),
2376
2470
  // Error response
2377
- z19.object({
2378
- error: z19.enum([
2471
+ z22.object({
2472
+ error: z22.enum([
2379
2473
  "api_error",
2380
2474
  "rate_limit",
2381
2475
  "timeout",
2382
2476
  "invalid_input",
2383
2477
  "unknown"
2384
2478
  ]),
2385
- statusCode: z19.number().optional(),
2386
- message: z19.string()
2479
+ statusCode: z22.number().optional(),
2480
+ message: z22.string()
2387
2481
  })
2388
2482
  ])
2389
2483
  )
2390
2484
  );
2391
- var perplexitySearchToolFactory = createProviderToolFactoryWithOutputSchema5({
2485
+ var perplexitySearchToolFactory = createProviderToolFactoryWithOutputSchema7({
2392
2486
  id: "gateway.perplexity_search",
2393
2487
  inputSchema: perplexitySearchInputSchema,
2394
2488
  outputSchema: perplexitySearchOutputSchema
@@ -2397,212 +2491,200 @@ var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
2397
2491
 
2398
2492
  // src/tool/tako-search.ts
2399
2493
  import {
2400
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
2401
- lazySchema as lazySchema19,
2402
- zodSchema as zodSchema19
2494
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2495
+ lazySchema as lazySchema21,
2496
+ zodSchema as zodSchema21
2403
2497
  } from "@ai-sdk/provider-utils";
2404
- import { z as z20 } from "zod";
2405
- var takoDataSourceInputSchema = () => z20.object({
2406
- count: z20.number().optional().describe(
2498
+ import { z as z23 } from "zod";
2499
+ var takoDataSourceInputSchema = () => z23.object({
2500
+ count: z23.number().optional().describe(
2407
2501
  "Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge."
2408
2502
  ),
2409
- include_contents: z20.boolean().optional().describe(
2503
+ include_contents: z23.boolean().optional().describe(
2410
2504
  "Inline rows for each data result. This adds a data surcharge based on row count and dataset source. To estimate cost, search with include_contents disabled and inspect cards.content.export_pricing. This applies to every returned card; limit sources.data.count and sources.data.max_rows to control cost."
2411
2505
  ),
2412
- mode: z20.enum(["inline", "url"]).optional().describe(
2506
+ mode: z23.enum(["inline", "url"]).optional().describe(
2413
2507
  "Requested data delivery mode. Search card data is always inline."
2414
2508
  ),
2415
- content_format: z20.enum(["card_json", "csv", "json_compact", "json_records"]).optional().describe("Serialization for inlined card data."),
2416
- max_rows: z20.number().optional().describe(
2509
+ content_format: z23.enum(["card_json", "csv", "json_compact", "json_records"]).optional().describe("Serialization for inlined card data."),
2510
+ max_rows: z23.number().optional().describe(
2417
2511
  "Maximum rows to inline per result. Omit to use the allowance in cards.content.export_pricing. A data surcharge applies per 1,000 exported rows; lower values reduce cost."
2418
2512
  ),
2419
- node_ids: z20.array(z20.string()).optional().describe("Data Graph node IDs to prioritize. Maximum 20."),
2420
- strict: z20.boolean().optional().describe(
2513
+ node_ids: z23.array(z23.string()).optional().describe("Data Graph node IDs to prioritize. Maximum 20."),
2514
+ strict: z23.boolean().optional().describe(
2421
2515
  "Only return cards matching node_ids. Requires a non-empty node_ids."
2422
2516
  )
2423
2517
  });
2424
- var takoWebSourceInputSchema = () => z20.object({
2425
- count: z20.number().optional().describe("Maximum number of web results to return (1-20)."),
2426
- include_contents: z20.boolean().optional().describe("Inline extracted web page text. This can add a data charge."),
2427
- category: z20.enum(["finance", "news", "sports"]).optional().describe("Optional web-result category filter."),
2428
- include_domains: z20.array(z20.string()).optional().describe("Only return results from these bare domains."),
2429
- exclude_domains: z20.array(z20.string()).optional().describe("Exclude results from these bare domains."),
2430
- snippet_max_chars: z20.number().optional().describe("Maximum characters in each web-result snippet."),
2431
- highlights: z20.boolean().optional().describe(
2518
+ var takoWebSourceInputSchema = () => z23.object({
2519
+ count: z23.number().optional().describe("Maximum number of web results to return (1-20)."),
2520
+ include_contents: z23.boolean().optional().describe("Inline extracted web page text. This can add a data charge."),
2521
+ category: z23.enum(["finance", "news", "sports"]).optional().describe("Optional web-result category filter."),
2522
+ include_domains: z23.array(z23.string()).optional().describe("Only return results from these bare domains."),
2523
+ exclude_domains: z23.array(z23.string()).optional().describe("Exclude results from these bare domains."),
2524
+ snippet_max_chars: z23.number().optional().describe("Maximum characters in each web-result snippet."),
2525
+ highlights: z23.boolean().optional().describe(
2432
2526
  "Include highlighted passages in web results. Defaults to true in AI Gateway."
2433
2527
  ),
2434
- article_content_max_chars: z20.number().optional().describe(
2528
+ article_content_max_chars: z23.number().optional().describe(
2435
2529
  "Maximum extracted characters per web page when including contents."
2436
2530
  ),
2437
- published_after: z20.string().optional().describe(
2531
+ published_after: z23.string().optional().describe(
2438
2532
  "Keep results published on or after this ISO date (YYYY-MM-DD)."
2439
2533
  ),
2440
- published_before: z20.string().optional().describe(
2534
+ published_before: z23.string().optional().describe(
2441
2535
  "Keep results published on or before this ISO date (YYYY-MM-DD)."
2442
2536
  )
2443
2537
  });
2444
- var takoSearchInputSchema = lazySchema19(
2445
- () => zodSchema19(
2446
- z20.object({
2447
- query: z20.string().describe(
2538
+ var takoSearchInputSchema = lazySchema21(
2539
+ () => zodSchema21(
2540
+ z23.object({
2541
+ query: z23.string().describe(
2448
2542
  'Natural-language search query. Include the entity, metric, and time period. Quote a phrase to force it to one entity, for example "Tesla":PRODUCT price.'
2449
2543
  ),
2450
- effort: z20.enum(["deep", "fast", "instant"]).optional().describe(
2544
+ effort: z23.enum(["deep", "fast", "instant"]).optional().describe(
2451
2545
  "Search effort. fast is the balanced default, instant favors cached results and low latency, and deep broadens retrieval with reranking at higher cost and latency."
2452
2546
  ),
2453
- sources: z20.object({
2547
+ sources: z23.object({
2454
2548
  data: takoDataSourceInputSchema().optional(),
2455
2549
  web: takoWebSourceInputSchema().optional()
2456
2550
  }).optional().describe(
2457
2551
  "Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched."
2458
2552
  ),
2459
- location: z20.object({
2460
- latitude: z20.number().describe("Latitude between -90 and 90."),
2461
- longitude: z20.number().describe("Longitude between -180 and 180.")
2553
+ location: z23.object({
2554
+ latitude: z23.number().describe("Latitude between -90 and 90."),
2555
+ longitude: z23.number().describe("Longitude between -180 and 180.")
2462
2556
  }).optional().describe("End-user coordinates for localized results."),
2463
- country_code: z20.string().optional().describe("Two-letter ISO 3166-1 country code, such as 'US'."),
2464
- locale: z20.string().optional().describe("BCP-47 locale, such as 'en-US'."),
2465
- timezone: z20.string().optional().describe("IANA timezone, such as 'America/New_York'."),
2466
- output_settings: z20.object({
2467
- image_dark_mode: z20.boolean().optional().describe("Render card preview images in dark mode."),
2468
- force_refresh: z20.boolean().optional().describe(
2557
+ country_code: z23.string().optional().describe("Two-letter ISO 3166-1 country code, such as 'US'."),
2558
+ locale: z23.string().optional().describe("BCP-47 locale, such as 'en-US'."),
2559
+ timezone: z23.string().optional().describe("IANA timezone, such as 'America/New_York'."),
2560
+ output_settings: z23.object({
2561
+ image_dark_mode: z23.boolean().optional().describe("Render card preview images in dark mode."),
2562
+ force_refresh: z23.boolean().optional().describe(
2469
2563
  "Instant-effort only. Request a refreshed instant result."
2470
2564
  )
2471
2565
  }).optional().describe("Controls card rendering in the search response."),
2472
- include_related: z20.number().optional().describe("Maximum related search suggestions to include (1-20).")
2566
+ include_related: z23.number().optional().describe("Maximum related search suggestions to include (1-20).")
2473
2567
  })
2474
2568
  )
2475
2569
  );
2476
- var takoDatasetCellSchema = () => z20.union([z20.boolean(), z20.number(), z20.string()]).nullable();
2477
- var takoResultContentSchema = () => z20.object({
2478
- content_format: z20.enum(["card_json", "csv", "json_compact", "json_records"]).nullish(),
2479
- cost: z20.number().optional(),
2480
- data: z20.string().nullish(),
2481
- records: z20.array(z20.record(z20.string(), takoDatasetCellSchema())).nullish(),
2482
- dataset: z20.object({
2483
- columns: z20.array(
2484
- z20.object({
2485
- name: z20.string(),
2486
- type: z20.enum(["boolean", "date", "datetime", "number", "string"]),
2487
- unit: z20.string().nullish()
2570
+ var takoDatasetCellSchema = () => z23.union([z23.boolean(), z23.number(), z23.string()]).nullable();
2571
+ var takoResultContentSchema = () => z23.object({
2572
+ content_format: z23.enum(["card_json", "csv", "json_compact", "json_records"]).nullish(),
2573
+ cost: z23.number().optional(),
2574
+ data: z23.string().nullish(),
2575
+ records: z23.array(z23.record(z23.string(), takoDatasetCellSchema())).nullish(),
2576
+ dataset: z23.object({
2577
+ columns: z23.array(
2578
+ z23.object({
2579
+ name: z23.string(),
2580
+ type: z23.enum(["boolean", "date", "datetime", "number", "string"]),
2581
+ unit: z23.string().nullish()
2488
2582
  })
2489
2583
  ),
2490
- rows: z20.array(z20.array(takoDatasetCellSchema())),
2491
- total_rows: z20.number(),
2492
- truncated: z20.boolean(),
2493
- ref: z20.string(),
2494
- sources: z20.array(
2495
- z20.object({
2496
- name: z20.string(),
2497
- index: z20.enum(["data", "web"]).optional()
2584
+ rows: z23.array(z23.array(takoDatasetCellSchema())),
2585
+ total_rows: z23.number(),
2586
+ truncated: z23.boolean(),
2587
+ ref: z23.string(),
2588
+ sources: z23.array(
2589
+ z23.object({
2590
+ name: z23.string(),
2591
+ index: z23.enum(["data", "web"]).optional()
2498
2592
  })
2499
2593
  ),
2500
- provenance: z20.enum(["query", "web_extraction"]).optional()
2594
+ provenance: z23.enum(["query", "web_extraction"]).optional()
2501
2595
  }).nullish(),
2502
- card_data: z20.object({}).passthrough().nullish(),
2503
- card_data_schema: z20.object({}).passthrough().nullish(),
2504
- url: z20.string().nullish(),
2505
- expires_at: z20.string().nullish(),
2506
- total_rows: z20.number().nullish(),
2507
- truncated: z20.boolean().optional(),
2508
- export_pricing: z20.object({
2509
- baseline_usd: z20.number(),
2510
- free_rows: z20.number(),
2511
- max_rows_ceiling: z20.number(),
2512
- row_cpm_usd: z20.number()
2596
+ card_data: z23.object({}).passthrough().nullish(),
2597
+ card_data_schema: z23.object({}).passthrough().nullish(),
2598
+ url: z23.string().nullish(),
2599
+ expires_at: z23.string().nullish(),
2600
+ total_rows: z23.number().nullish(),
2601
+ truncated: z23.boolean().optional(),
2602
+ export_pricing: z23.object({
2603
+ baseline_usd: z23.number(),
2604
+ free_rows: z23.number(),
2605
+ max_rows_ceiling: z23.number(),
2606
+ row_cpm_usd: z23.number()
2513
2607
  }).nullish(),
2514
- manifest: z20.array(
2515
- z20.object({
2516
- dtype: z20.enum(["boolean", "date", "datetime", "number", "string"]).nullish(),
2517
- entity: z20.string().nullish(),
2518
- metric: z20.string().nullish(),
2519
- name: z20.string().nullish(),
2520
- unit: z20.string().nullish()
2608
+ manifest: z23.array(
2609
+ z23.object({
2610
+ dtype: z23.enum(["boolean", "date", "datetime", "number", "string"]).nullish(),
2611
+ entity: z23.string().nullish(),
2612
+ metric: z23.string().nullish(),
2613
+ name: z23.string().nullish(),
2614
+ unit: z23.string().nullish()
2521
2615
  })
2522
2616
  ).nullish()
2523
2617
  }).passthrough();
2524
- var takoCardSchema = () => z20.object({
2525
- card_id: z20.string().nullish(),
2526
- title: z20.string().nullish(),
2527
- description: z20.string().nullish(),
2528
- semantic_description: z20.string().nullish(),
2529
- webpage_url: z20.string().nullish(),
2530
- image_url: z20.string().nullish(),
2531
- embed_url: z20.string().nullish(),
2532
- sources: z20.array(
2533
- z20.object({
2534
- source_name: z20.string().nullish(),
2535
- source_description: z20.string().nullish(),
2536
- source_index: z20.enum(["data", "web"]),
2537
- source_text: z20.string().nullish(),
2538
- url: z20.string().nullish()
2618
+ var takoCardSchema = () => z23.object({
2619
+ card_id: z23.string().nullish(),
2620
+ title: z23.string().nullish(),
2621
+ description: z23.string().nullish(),
2622
+ semantic_description: z23.string().nullish(),
2623
+ webpage_url: z23.string().nullish(),
2624
+ image_url: z23.string().nullish(),
2625
+ embed_url: z23.string().nullish(),
2626
+ sources: z23.array(
2627
+ z23.object({
2628
+ source_name: z23.string().nullish(),
2629
+ source_description: z23.string().nullish(),
2630
+ source_index: z23.enum(["data", "web"]),
2631
+ source_text: z23.string().nullish(),
2632
+ url: z23.string().nullish()
2539
2633
  })
2540
2634
  ).nullish(),
2541
- methodologies: z20.array(
2542
- z20.object({
2543
- methodology_name: z20.string().nullable(),
2544
- methodology_description: z20.string().nullable()
2635
+ methodologies: z23.array(
2636
+ z23.object({
2637
+ methodology_name: z23.string().nullable(),
2638
+ methodology_description: z23.string().nullable()
2545
2639
  })
2546
2640
  ).nullish(),
2547
- source_indexes: z20.array(z20.enum(["data", "web"])).nullish(),
2548
- card_type: z20.string().nullish(),
2549
- relevance: z20.enum(["High", "Low", "Medium"]).nullish(),
2641
+ source_indexes: z23.array(z23.enum(["data", "web"])).nullish(),
2642
+ card_type: z23.string().nullish(),
2643
+ relevance: z23.enum(["High", "Low", "Medium"]).nullish(),
2550
2644
  content: takoResultContentSchema().nullish(),
2551
- exportable: z20.boolean().optional(),
2552
- nodes: z20.array(
2553
- z20.object({
2554
- id: z20.string(),
2555
- type: z20.enum(["entity", "metric"]),
2556
- name: z20.string(),
2557
- description: z20.string().nullish()
2645
+ exportable: z23.boolean().optional(),
2646
+ nodes: z23.array(
2647
+ z23.object({
2648
+ id: z23.string(),
2649
+ type: z23.enum(["entity", "metric"]),
2650
+ name: z23.string(),
2651
+ description: z23.string().nullish()
2558
2652
  })
2559
2653
  ).nullish(),
2560
- metric_definitions: z20.array(z20.object({ name: z20.string(), definition: z20.string() })).nullish(),
2561
- data_freshness: z20.object({
2562
- coverage_end: z20.string().nullish(),
2563
- data_as_of: z20.string().nullish(),
2564
- last_updated: z20.string().nullish()
2654
+ metric_definitions: z23.array(z23.object({ name: z23.string(), definition: z23.string() })).nullish(),
2655
+ data_freshness: z23.object({
2656
+ coverage_end: z23.string().nullish(),
2657
+ data_as_of: z23.string().nullish(),
2658
+ last_updated: z23.string().nullish()
2565
2659
  }).nullish()
2566
2660
  }).passthrough();
2567
- var takoWebResultSchema = () => z20.object({
2568
- title: z20.string(),
2569
- url: z20.string(),
2570
- snippet: z20.string().nullish(),
2571
- source_name: z20.string().nullish(),
2572
- publish_date: z20.string().nullish(),
2661
+ var takoWebResultSchema = () => z23.object({
2662
+ title: z23.string(),
2663
+ url: z23.string(),
2664
+ snippet: z23.string().nullish(),
2665
+ source_name: z23.string().nullish(),
2666
+ publish_date: z23.string().nullish(),
2573
2667
  content: takoResultContentSchema().nullish()
2574
2668
  }).passthrough();
2575
- var takoSearchOutputSchema = lazySchema19(
2576
- () => zodSchema19(
2577
- z20.union([
2578
- z20.object({
2579
- request_id: z20.string(),
2580
- cards: z20.array(takoCardSchema()).optional(),
2581
- web_results: z20.array(takoWebResultSchema()).optional(),
2582
- usage: z20.object({
2583
- total_cost_usd: z20.number(),
2584
- compute: z20.object({ cost_usd: z20.number() }).nullish(),
2585
- data: z20.object({ cost_usd: z20.number(), datasets: z20.number() }).nullish()
2669
+ var takoSearchOutputSchema = lazySchema21(
2670
+ () => zodSchema21(
2671
+ z23.union([
2672
+ z23.object({
2673
+ request_id: z23.string(),
2674
+ cards: z23.array(takoCardSchema()).optional(),
2675
+ web_results: z23.array(takoWebResultSchema()).optional(),
2676
+ usage: z23.object({
2677
+ total_cost_usd: z23.number(),
2678
+ compute: z23.object({ cost_usd: z23.number() }).nullish(),
2679
+ data: z23.object({ cost_usd: z23.number(), datasets: z23.number() }).nullish()
2586
2680
  }).nullish(),
2587
- related: z20.array(z20.object({}).passthrough()).nullish()
2681
+ related: z23.array(z23.object({}).passthrough()).nullish()
2588
2682
  }).passthrough(),
2589
- z20.object({
2590
- error: z20.enum([
2591
- "api_error",
2592
- "configuration_error",
2593
- "execution_error",
2594
- "invalid_input",
2595
- "rate_limit",
2596
- "timeout",
2597
- "unknown_tool"
2598
- ]),
2599
- statusCode: z20.number().optional(),
2600
- message: z20.string()
2601
- })
2683
+ gatewayToolErrorSchema()
2602
2684
  ])
2603
2685
  )
2604
2686
  );
2605
- var takoSearchToolFactory = createProviderToolFactoryWithOutputSchema6({
2687
+ var takoSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
2606
2688
  id: "gateway.tako_search",
2607
2689
  inputSchema: takoSearchInputSchema,
2608
2690
  outputSchema: takoSearchOutputSchema
@@ -2625,6 +2707,16 @@ var gatewayTools = {
2625
2707
  * a browser session.
2626
2708
  */
2627
2709
  browserbaseSearch,
2710
+ /**
2711
+ * Fetch a page as Markdown through DeepSeek's standalone Fetch API.
2712
+ * Executed by AI Gateway for any model, separate from native model web search.
2713
+ */
2714
+ deepseekFetch,
2715
+ /**
2716
+ * Search the web through DeepSeek's standalone Search API.
2717
+ * Executed by AI Gateway for any model, separate from native model web search.
2718
+ */
2719
+ deepseekSearch,
2628
2720
  /**
2629
2721
  * Search the web using Exa for current information and token-efficient
2630
2722
  * excerpts optimized for agent workflows.
@@ -2670,7 +2762,7 @@ async function getVercelRequestId() {
2670
2762
  }
2671
2763
 
2672
2764
  // src/version.ts
2673
- var VERSION = true ? "3.0.226" : "0.0.0-test";
2765
+ var VERSION = true ? "3.0.227" : "0.0.0-test";
2674
2766
 
2675
2767
  // src/gateway-provider.ts
2676
2768
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";