@ai-sdk/gateway 3.0.219 → 3.0.221
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 +19 -0
- package/dist/index.d.mts +83 -32
- package/dist/index.d.ts +83 -32
- package/dist/index.js +49 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -20
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +30 -11
- package/package.json +1 -1
- package/src/gateway-language-model-settings.ts +4 -0
- package/src/gateway-reranking-model-settings.ts +2 -0
- package/src/gateway-speech-model-settings.ts +1 -0
- package/src/gateway-transcription-model-settings.ts +2 -0
- package/src/tool/parallel-search.ts +158 -46
package/dist/index.mjs
CHANGED
|
@@ -2200,6 +2200,14 @@ import {
|
|
|
2200
2200
|
zodSchema as zodSchema17
|
|
2201
2201
|
} from "@ai-sdk/provider-utils";
|
|
2202
2202
|
import { z as z18 } from "zod";
|
|
2203
|
+
var parallelSearchModes = [
|
|
2204
|
+
"turbo",
|
|
2205
|
+
"fast",
|
|
2206
|
+
"basic",
|
|
2207
|
+
"advanced",
|
|
2208
|
+
"one-shot",
|
|
2209
|
+
"agentic"
|
|
2210
|
+
];
|
|
2203
2211
|
var parallelSearchInputSchema = lazySchema17(
|
|
2204
2212
|
() => zodSchema17(
|
|
2205
2213
|
z18.object({
|
|
@@ -2207,64 +2215,85 @@ var parallelSearchInputSchema = lazySchema17(
|
|
|
2207
2215
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
2208
2216
|
),
|
|
2209
2217
|
search_queries: z18.array(z18.string()).optional().describe(
|
|
2210
|
-
"
|
|
2218
|
+
"Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."
|
|
2211
2219
|
),
|
|
2212
|
-
mode: z18.enum(
|
|
2213
|
-
'
|
|
2220
|
+
mode: z18.enum(parallelSearchModes).optional().describe(
|
|
2221
|
+
'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".'
|
|
2214
2222
|
),
|
|
2215
2223
|
max_results: z18.number().optional().describe(
|
|
2216
2224
|
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
2217
2225
|
),
|
|
2218
2226
|
source_policy: z18.object({
|
|
2219
2227
|
include_domains: z18.array(z18.string()).optional().describe(
|
|
2220
|
-
"
|
|
2228
|
+
"Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."
|
|
2221
2229
|
),
|
|
2222
2230
|
exclude_domains: z18.array(z18.string()).optional().describe(
|
|
2223
|
-
"
|
|
2231
|
+
"Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."
|
|
2224
2232
|
),
|
|
2225
2233
|
after_date: z18.string().optional().describe(
|
|
2226
|
-
"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."
|
|
2234
|
+
"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."
|
|
2227
2235
|
)
|
|
2228
2236
|
}).optional().describe(
|
|
2229
2237
|
"Source policy for controlling which domains to include/exclude and freshness."
|
|
2230
2238
|
),
|
|
2231
2239
|
excerpts: z18.object({
|
|
2232
2240
|
max_chars_per_result: z18.number().optional().describe("Maximum characters per result."),
|
|
2233
|
-
max_chars_total: z18.number().optional().describe("
|
|
2241
|
+
max_chars_total: z18.number().optional().describe("Deprecated: use the top-level max_chars_total.")
|
|
2234
2242
|
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
2243
|
+
max_chars_total: z18.number().optional().describe("Maximum total characters across all result excerpts."),
|
|
2235
2244
|
fetch_policy: z18.object({
|
|
2236
2245
|
max_age_seconds: z18.number().optional().describe(
|
|
2237
|
-
"Maximum age
|
|
2246
|
+
"Maximum age of cached content in seconds before a live fetch, minimum 600."
|
|
2247
|
+
),
|
|
2248
|
+
timeout_seconds: z18.number().optional().describe(
|
|
2249
|
+
"Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."
|
|
2250
|
+
),
|
|
2251
|
+
disable_cache_fallback: z18.boolean().optional().describe(
|
|
2252
|
+
"Return an error instead of older cached content when a live fetch fails."
|
|
2238
2253
|
)
|
|
2239
|
-
}).optional().describe("Fetch policy for controlling content freshness.")
|
|
2254
|
+
}).optional().describe("Fetch policy for controlling content freshness."),
|
|
2255
|
+
location: z18.string().optional().describe(
|
|
2256
|
+
'ISO 3166-1 alpha-2 country code to localize results, e.g. "us".'
|
|
2257
|
+
)
|
|
2240
2258
|
})
|
|
2241
2259
|
)
|
|
2242
2260
|
);
|
|
2243
2261
|
var parallelSearchOutputSchema = lazySchema17(
|
|
2244
2262
|
() => zodSchema17(
|
|
2245
2263
|
z18.union([
|
|
2246
|
-
// Success response
|
|
2264
|
+
// Success response (Parallel's response, passed through by the gateway)
|
|
2247
2265
|
z18.object({
|
|
2248
|
-
|
|
2266
|
+
search_id: z18.string(),
|
|
2249
2267
|
results: z18.array(
|
|
2250
2268
|
z18.object({
|
|
2251
2269
|
url: z18.string(),
|
|
2252
|
-
title: z18.string(),
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
relevanceScore: z18.number().optional()
|
|
2270
|
+
title: z18.string().nullable().optional(),
|
|
2271
|
+
publish_date: z18.string().nullable().optional(),
|
|
2272
|
+
excerpts: z18.array(z18.string())
|
|
2256
2273
|
})
|
|
2257
|
-
)
|
|
2274
|
+
),
|
|
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()
|
|
2280
|
+
})
|
|
2281
|
+
).nullable().optional(),
|
|
2282
|
+
usage: z18.array(z18.object({ name: z18.string(), count: z18.number().optional() })).nullable().optional(),
|
|
2283
|
+
session_id: z18.string().optional()
|
|
2258
2284
|
}),
|
|
2259
2285
|
// Error response
|
|
2260
2286
|
z18.object({
|
|
2261
2287
|
error: z18.enum([
|
|
2262
2288
|
"api_error",
|
|
2289
|
+
"configuration_error",
|
|
2290
|
+
"execution_error",
|
|
2291
|
+
"gateway_rate_limit",
|
|
2292
|
+
"invalid_input",
|
|
2263
2293
|
"rate_limit",
|
|
2264
2294
|
"timeout",
|
|
2265
|
-
"
|
|
2266
|
-
"
|
|
2267
|
-
"unknown"
|
|
2295
|
+
"unknown",
|
|
2296
|
+
"unknown_tool"
|
|
2268
2297
|
]),
|
|
2269
2298
|
statusCode: z18.number().optional(),
|
|
2270
2299
|
message: z18.string()
|
|
@@ -2641,7 +2670,7 @@ async function getVercelRequestId() {
|
|
|
2641
2670
|
}
|
|
2642
2671
|
|
|
2643
2672
|
// src/version.ts
|
|
2644
|
-
var VERSION = true ? "3.0.
|
|
2673
|
+
var VERSION = true ? "3.0.221" : "0.0.0-test";
|
|
2645
2674
|
|
|
2646
2675
|
// src/gateway-provider.ts
|
|
2647
2676
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|