@ai-sdk/gateway 3.0.179 → 3.0.181
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 +16 -0
- package/README.md +1 -1
- package/dist/index.d.mts +234 -2
- package/dist/index.d.ts +234 -2
- package/dist/index.js +223 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +219 -2
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +107 -1
- package/package.json +2 -2
- package/src/gateway-language-model-settings.ts +1 -0
- package/src/gateway-tools.ts +11 -0
- package/src/gateway-video-model-settings.ts +1 -0
- package/src/tool/tako-search.ts +581 -0
package/dist/index.mjs
CHANGED
|
@@ -2215,6 +2215,214 @@ var perplexitySearchToolFactory = createProviderToolFactoryWithOutputSchema3({
|
|
|
2215
2215
|
});
|
|
2216
2216
|
var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
|
|
2217
2217
|
|
|
2218
|
+
// src/tool/tako-search.ts
|
|
2219
|
+
import {
|
|
2220
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
2221
|
+
lazySchema as lazySchema13,
|
|
2222
|
+
zodSchema as zodSchema13
|
|
2223
|
+
} from "@ai-sdk/provider-utils";
|
|
2224
|
+
import { z as z18 } from "zod";
|
|
2225
|
+
var takoDataSourceInputSchema = z18.object({
|
|
2226
|
+
count: z18.number().optional().describe("Maximum number of data cards to return (1-20)."),
|
|
2227
|
+
include_contents: z18.boolean().optional().describe("Inline underlying card data. This can add a data charge."),
|
|
2228
|
+
mode: z18.enum(["inline", "url"]).optional().describe(
|
|
2229
|
+
"Requested data delivery mode. Search card data is always inline."
|
|
2230
|
+
),
|
|
2231
|
+
content_format: z18.enum(["card_json", "csv", "json_compact", "json_records"]).optional().describe("Serialization for inlined card data."),
|
|
2232
|
+
max_rows: z18.number().optional().describe("Maximum rows for inlined card data."),
|
|
2233
|
+
node_ids: z18.array(z18.string()).optional().describe("Data Graph node IDs to prioritize. Maximum 20."),
|
|
2234
|
+
strict: z18.boolean().optional().describe(
|
|
2235
|
+
"Only return cards matching node_ids. Requires a non-empty node_ids."
|
|
2236
|
+
)
|
|
2237
|
+
});
|
|
2238
|
+
var takoWebSourceInputSchema = z18.object({
|
|
2239
|
+
count: z18.number().optional().describe("Maximum number of web results to return (1-20)."),
|
|
2240
|
+
include_contents: z18.boolean().optional().describe("Inline extracted web page text. This can add a data charge."),
|
|
2241
|
+
category: z18.enum(["finance", "news", "sports"]).optional().describe("Optional web-result category filter."),
|
|
2242
|
+
include_domains: z18.array(z18.string()).optional().describe("Only return results from these bare domains."),
|
|
2243
|
+
exclude_domains: z18.array(z18.string()).optional().describe("Exclude results from these bare domains."),
|
|
2244
|
+
snippet_max_chars: z18.number().optional().describe("Maximum characters in each web-result snippet."),
|
|
2245
|
+
highlights: z18.boolean().optional().describe(
|
|
2246
|
+
"Include highlighted passages in web results. Defaults to true in AI Gateway."
|
|
2247
|
+
),
|
|
2248
|
+
article_content_max_chars: z18.number().optional().describe(
|
|
2249
|
+
"Maximum extracted characters per web page when including contents."
|
|
2250
|
+
),
|
|
2251
|
+
published_after: z18.string().optional().describe("Keep results published on or after this ISO date (YYYY-MM-DD)."),
|
|
2252
|
+
published_before: z18.string().optional().describe(
|
|
2253
|
+
"Keep results published on or before this ISO date (YYYY-MM-DD)."
|
|
2254
|
+
)
|
|
2255
|
+
});
|
|
2256
|
+
var takoSearchInputSchema = lazySchema13(
|
|
2257
|
+
() => zodSchema13(
|
|
2258
|
+
z18.object({
|
|
2259
|
+
query: z18.string().describe(
|
|
2260
|
+
'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.'
|
|
2261
|
+
),
|
|
2262
|
+
effort: z18.enum(["deep", "fast", "instant"]).optional().describe(
|
|
2263
|
+
"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."
|
|
2264
|
+
),
|
|
2265
|
+
sources: z18.object({
|
|
2266
|
+
data: takoDataSourceInputSchema.optional(),
|
|
2267
|
+
web: takoWebSourceInputSchema.optional()
|
|
2268
|
+
}).optional().describe(
|
|
2269
|
+
"Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched."
|
|
2270
|
+
),
|
|
2271
|
+
location: z18.object({
|
|
2272
|
+
latitude: z18.number().describe("Latitude between -90 and 90."),
|
|
2273
|
+
longitude: z18.number().describe("Longitude between -180 and 180.")
|
|
2274
|
+
}).optional().describe("End-user coordinates for localized results."),
|
|
2275
|
+
country_code: z18.string().optional().describe("Two-letter ISO 3166-1 country code, such as 'US'."),
|
|
2276
|
+
locale: z18.string().optional().describe("BCP-47 locale, such as 'en-US'."),
|
|
2277
|
+
timezone: z18.string().optional().describe("IANA timezone, such as 'America/New_York'."),
|
|
2278
|
+
output_settings: z18.object({
|
|
2279
|
+
image_dark_mode: z18.boolean().optional().describe("Render card preview images in dark mode."),
|
|
2280
|
+
force_refresh: z18.boolean().optional().describe(
|
|
2281
|
+
"Instant-effort only. Request a refreshed instant result."
|
|
2282
|
+
)
|
|
2283
|
+
}).optional().describe("Controls card rendering in the search response."),
|
|
2284
|
+
include_related: z18.number().optional().describe("Maximum related search suggestions to include (1-20).")
|
|
2285
|
+
})
|
|
2286
|
+
)
|
|
2287
|
+
);
|
|
2288
|
+
var takoDatasetCellSchema = z18.union([z18.boolean(), z18.number(), z18.string()]).nullable();
|
|
2289
|
+
var takoResultContentSchema = z18.object({
|
|
2290
|
+
content_format: z18.enum(["card_json", "csv", "json_compact", "json_records"]).nullish(),
|
|
2291
|
+
cost: z18.number().optional(),
|
|
2292
|
+
data: z18.string().nullish(),
|
|
2293
|
+
records: z18.array(z18.record(z18.string(), takoDatasetCellSchema)).nullish(),
|
|
2294
|
+
dataset: z18.object({
|
|
2295
|
+
columns: z18.array(
|
|
2296
|
+
z18.object({
|
|
2297
|
+
name: z18.string(),
|
|
2298
|
+
type: z18.enum(["boolean", "date", "datetime", "number", "string"]),
|
|
2299
|
+
unit: z18.string().nullish()
|
|
2300
|
+
})
|
|
2301
|
+
),
|
|
2302
|
+
rows: z18.array(z18.array(takoDatasetCellSchema)),
|
|
2303
|
+
total_rows: z18.number(),
|
|
2304
|
+
truncated: z18.boolean(),
|
|
2305
|
+
ref: z18.string(),
|
|
2306
|
+
sources: z18.array(
|
|
2307
|
+
z18.object({
|
|
2308
|
+
name: z18.string(),
|
|
2309
|
+
index: z18.enum(["data", "web"]).optional()
|
|
2310
|
+
})
|
|
2311
|
+
),
|
|
2312
|
+
provenance: z18.enum(["query", "web_extraction"]).optional()
|
|
2313
|
+
}).nullish(),
|
|
2314
|
+
card_data: z18.object({}).passthrough().nullish(),
|
|
2315
|
+
card_data_schema: z18.object({}).passthrough().nullish(),
|
|
2316
|
+
url: z18.string().nullish(),
|
|
2317
|
+
expires_at: z18.string().nullish(),
|
|
2318
|
+
total_rows: z18.number().nullish(),
|
|
2319
|
+
truncated: z18.boolean().optional(),
|
|
2320
|
+
export_pricing: z18.object({
|
|
2321
|
+
baseline_usd: z18.number(),
|
|
2322
|
+
free_rows: z18.number(),
|
|
2323
|
+
max_rows_ceiling: z18.number(),
|
|
2324
|
+
row_cpm_usd: z18.number()
|
|
2325
|
+
}).nullish(),
|
|
2326
|
+
manifest: z18.array(
|
|
2327
|
+
z18.object({
|
|
2328
|
+
dtype: z18.enum(["boolean", "date", "datetime", "number", "string"]).nullish(),
|
|
2329
|
+
entity: z18.string().nullish(),
|
|
2330
|
+
metric: z18.string().nullish(),
|
|
2331
|
+
name: z18.string().nullish(),
|
|
2332
|
+
unit: z18.string().nullish()
|
|
2333
|
+
})
|
|
2334
|
+
).nullish()
|
|
2335
|
+
}).passthrough();
|
|
2336
|
+
var takoCardSchema = z18.object({
|
|
2337
|
+
card_id: z18.string().nullish(),
|
|
2338
|
+
title: z18.string().nullish(),
|
|
2339
|
+
description: z18.string().nullish(),
|
|
2340
|
+
semantic_description: z18.string().nullish(),
|
|
2341
|
+
webpage_url: z18.string().nullish(),
|
|
2342
|
+
image_url: z18.string().nullish(),
|
|
2343
|
+
embed_url: z18.string().nullish(),
|
|
2344
|
+
sources: z18.array(
|
|
2345
|
+
z18.object({
|
|
2346
|
+
source_name: z18.string().nullish(),
|
|
2347
|
+
source_description: z18.string().nullish(),
|
|
2348
|
+
source_index: z18.enum(["data", "web"]),
|
|
2349
|
+
source_text: z18.string().nullish(),
|
|
2350
|
+
url: z18.string().nullish()
|
|
2351
|
+
})
|
|
2352
|
+
).nullish(),
|
|
2353
|
+
methodologies: z18.array(
|
|
2354
|
+
z18.object({
|
|
2355
|
+
methodology_name: z18.string().nullable(),
|
|
2356
|
+
methodology_description: z18.string().nullable()
|
|
2357
|
+
})
|
|
2358
|
+
).nullish(),
|
|
2359
|
+
source_indexes: z18.array(z18.enum(["data", "web"])).nullish(),
|
|
2360
|
+
card_type: z18.string().nullish(),
|
|
2361
|
+
relevance: z18.enum(["High", "Low", "Medium"]).nullish(),
|
|
2362
|
+
content: takoResultContentSchema.nullish(),
|
|
2363
|
+
exportable: z18.boolean().optional(),
|
|
2364
|
+
relevance_score: z18.number().nullish(),
|
|
2365
|
+
nodes: z18.array(
|
|
2366
|
+
z18.object({
|
|
2367
|
+
id: z18.string(),
|
|
2368
|
+
type: z18.enum(["entity", "metric"]),
|
|
2369
|
+
name: z18.string(),
|
|
2370
|
+
description: z18.string().nullish()
|
|
2371
|
+
})
|
|
2372
|
+
).nullish(),
|
|
2373
|
+
metric_definitions: z18.array(z18.object({ name: z18.string(), definition: z18.string() })).nullish(),
|
|
2374
|
+
data_freshness: z18.object({
|
|
2375
|
+
coverage_end: z18.string().nullish(),
|
|
2376
|
+
data_as_of: z18.string().nullish(),
|
|
2377
|
+
last_updated: z18.string().nullish()
|
|
2378
|
+
}).nullish()
|
|
2379
|
+
}).passthrough();
|
|
2380
|
+
var takoWebResultSchema = z18.object({
|
|
2381
|
+
title: z18.string(),
|
|
2382
|
+
url: z18.string(),
|
|
2383
|
+
snippet: z18.string().nullish(),
|
|
2384
|
+
source_name: z18.string().nullish(),
|
|
2385
|
+
publish_date: z18.string().nullish(),
|
|
2386
|
+
content: takoResultContentSchema.nullish(),
|
|
2387
|
+
citation_number: z18.number().nullish()
|
|
2388
|
+
}).passthrough();
|
|
2389
|
+
var takoSearchOutputSchema = lazySchema13(
|
|
2390
|
+
() => zodSchema13(
|
|
2391
|
+
z18.union([
|
|
2392
|
+
z18.object({
|
|
2393
|
+
request_id: z18.string(),
|
|
2394
|
+
cards: z18.array(takoCardSchema).optional(),
|
|
2395
|
+
web_results: z18.array(takoWebResultSchema).optional(),
|
|
2396
|
+
usage: z18.object({
|
|
2397
|
+
total_cost_usd: z18.number(),
|
|
2398
|
+
compute: z18.object({ cost_usd: z18.number() }).nullish(),
|
|
2399
|
+
data: z18.object({ cost_usd: z18.number(), datasets: z18.number() }).nullish()
|
|
2400
|
+
}).nullish(),
|
|
2401
|
+
related: z18.array(z18.object({}).passthrough()).nullish()
|
|
2402
|
+
}).passthrough(),
|
|
2403
|
+
z18.object({
|
|
2404
|
+
error: z18.enum([
|
|
2405
|
+
"api_error",
|
|
2406
|
+
"configuration_error",
|
|
2407
|
+
"execution_error",
|
|
2408
|
+
"invalid_input",
|
|
2409
|
+
"rate_limit",
|
|
2410
|
+
"timeout",
|
|
2411
|
+
"unknown_tool"
|
|
2412
|
+
]),
|
|
2413
|
+
statusCode: z18.number().optional(),
|
|
2414
|
+
message: z18.string()
|
|
2415
|
+
})
|
|
2416
|
+
])
|
|
2417
|
+
)
|
|
2418
|
+
);
|
|
2419
|
+
var takoSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
|
|
2420
|
+
id: "gateway.tako_search",
|
|
2421
|
+
inputSchema: takoSearchInputSchema,
|
|
2422
|
+
outputSchema: takoSearchOutputSchema
|
|
2423
|
+
});
|
|
2424
|
+
var takoSearch = (config = {}) => takoSearchToolFactory(config);
|
|
2425
|
+
|
|
2218
2426
|
// src/gateway-tools.ts
|
|
2219
2427
|
var gatewayTools = {
|
|
2220
2428
|
/**
|
|
@@ -2241,7 +2449,16 @@ var gatewayTools = {
|
|
|
2241
2449
|
* Provides ranked search results with advanced filtering options including
|
|
2242
2450
|
* domain, language, date range, and recency filters.
|
|
2243
2451
|
*/
|
|
2244
|
-
perplexitySearch
|
|
2452
|
+
perplexitySearch,
|
|
2453
|
+
/**
|
|
2454
|
+
* Search the web and Tako's curated knowledge graph in one call for
|
|
2455
|
+
* token-efficient web excerpts and structured data results grounded in
|
|
2456
|
+
* premium sources, each with an embed-ready visualization.
|
|
2457
|
+
*
|
|
2458
|
+
* Supports effort, per-source web and data controls, localization, and inline
|
|
2459
|
+
* contents for agents that need to reason over underlying data.
|
|
2460
|
+
*/
|
|
2461
|
+
takoSearch
|
|
2245
2462
|
};
|
|
2246
2463
|
|
|
2247
2464
|
// src/vercel-environment.ts
|
|
@@ -2253,7 +2470,7 @@ async function getVercelRequestId() {
|
|
|
2253
2470
|
}
|
|
2254
2471
|
|
|
2255
2472
|
// src/version.ts
|
|
2256
|
-
var VERSION = true ? "3.0.
|
|
2473
|
+
var VERSION = true ? "3.0.181" : "0.0.0-test";
|
|
2257
2474
|
|
|
2258
2475
|
// src/gateway-provider.ts
|
|
2259
2476
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|