@ai-sdk/gateway 4.0.139 → 4.0.142
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 +33 -0
- package/dist/index.d.ts +45 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +456 -416
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +38 -1
- package/package.json +3 -3
- package/src/errors/create-gateway-error.ts +4 -4
- package/src/gateway-batch.ts +29 -27
- package/src/gateway-decision-model-settings.ts +1 -0
- package/src/gateway-decision-model.ts +21 -21
- package/src/gateway-embedding-model.ts +7 -7
- package/src/gateway-fetch-metadata.ts +33 -29
- package/src/gateway-generation-info.ts +13 -11
- package/src/gateway-image-model.ts +17 -16
- package/src/gateway-language-model-settings.ts +6 -0
- package/src/gateway-provider-options.ts +72 -50
- package/src/gateway-provider.ts +1 -1
- package/src/gateway-reranking-model.ts +6 -6
- package/src/gateway-speech-model.ts +8 -8
- package/src/gateway-spend-report.ts +19 -18
- package/src/gateway-transcription-model.ts +18 -18
- package/src/gateway-video-model.ts +31 -30
- package/src/tool/browserbase-fetch.ts +22 -29
- package/src/tool/browserbase-search.ts +15 -17
- package/src/tool/deepseek-fetch.ts +10 -10
- package/src/tool/deepseek-search.ts +36 -37
- package/src/tool/exa-search.ts +132 -125
- package/src/tool/gateway-tool-error.ts +8 -7
- package/src/tool/parallel-search.ts +93 -104
- package/src/tool/perplexity-search.ts +62 -85
- package/src/tool/tako-search.ts +319 -251
- package/src/zod.ts +47 -5
package/src/tool/tako-search.ts
CHANGED
|
@@ -97,6 +97,23 @@ export interface TakoSearchConfig {
|
|
|
97
97
|
};
|
|
98
98
|
/** Maximum related search suggestions to include (1-20). */
|
|
99
99
|
includeRelated?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Serve per-unit-priced data, such as web traffic and SEO. Each such card adds
|
|
102
|
+
* a charge, capped by maxVariableCostUsd. On by default; set false to opt out,
|
|
103
|
+
* and those cards come back as placeholders.
|
|
104
|
+
*/
|
|
105
|
+
variableCost?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Most one call can be charged in variable cost, in USD. Defaults to 0.25;
|
|
108
|
+
* null removes the cap. Cards that don't fit come back as placeholders with
|
|
109
|
+
* reason 'over_cap'. Can't be combined with variableCost: false.
|
|
110
|
+
*/
|
|
111
|
+
maxVariableCostUsd?: number | null;
|
|
112
|
+
/**
|
|
113
|
+
* Extra Tako request fields in snake_case, deep-merged into the body last.
|
|
114
|
+
* Can't set fields this tool models; Tako rejects unknown keys (api_error).
|
|
115
|
+
*/
|
|
116
|
+
extraBody?: Record<string, unknown>;
|
|
100
117
|
}
|
|
101
118
|
|
|
102
119
|
export interface TakoSearchInput {
|
|
@@ -168,11 +185,22 @@ export interface TakoResultContent {
|
|
|
168
185
|
expires_at?: string | null;
|
|
169
186
|
total_rows?: number | null;
|
|
170
187
|
truncated?: boolean;
|
|
188
|
+
/** Distinct records per premium class (e.g. company_record) among delivered rows. */
|
|
189
|
+
premium_rows?: Record<string, number> | null;
|
|
190
|
+
/** Column header → 0-based delivered-row positions whose premium value was withheld. */
|
|
191
|
+
redacted_cells?: Record<string, number[]> | null;
|
|
192
|
+
/** Full set size when the card lists only a capped slice of it. */
|
|
193
|
+
total_matching?: number | null;
|
|
171
194
|
export_pricing?: {
|
|
172
195
|
baseline_usd: number;
|
|
173
|
-
|
|
196
|
+
/** @deprecated Always 0, and Tako will stop sending it. */
|
|
197
|
+
free_rows?: number;
|
|
174
198
|
max_rows_ceiling: number;
|
|
175
199
|
row_cpm_usd: number;
|
|
200
|
+
/** USD per 1,000 premium records by class, added to row_cpm_usd when premium. */
|
|
201
|
+
premium_row_cpm_usd?: Record<string, number> | null;
|
|
202
|
+
/** Upper bound on this card's variable-cost charge; set only for per-unit-priced sources. */
|
|
203
|
+
variable_cost_max_usd?: number | null;
|
|
176
204
|
} | null;
|
|
177
205
|
manifest?: Array<{
|
|
178
206
|
dtype?: 'boolean' | 'date' | 'datetime' | 'number' | 'string' | null;
|
|
@@ -205,6 +233,8 @@ export interface TakoCard {
|
|
|
205
233
|
source_indexes?: Array<'data' | 'web'> | null;
|
|
206
234
|
card_type?: string | null;
|
|
207
235
|
relevance?: 'High' | 'Low' | 'Medium' | null;
|
|
236
|
+
/** Relevance to the query, 1.0-5.0. Null unless the account is entitled. */
|
|
237
|
+
relevance_score?: number | null;
|
|
208
238
|
content?: TakoResultContent | null;
|
|
209
239
|
exportable?: boolean;
|
|
210
240
|
nodes?: Array<{
|
|
@@ -222,6 +252,14 @@ export interface TakoCard {
|
|
|
222
252
|
data_as_of?: string | null;
|
|
223
253
|
last_updated?: string | null;
|
|
224
254
|
} | null;
|
|
255
|
+
/**
|
|
256
|
+
* Set when Tako withholds the card's data: variable cost off or not served
|
|
257
|
+
* (`not_served`), or over maxVariableCostUsd (`over_cap`).
|
|
258
|
+
*/
|
|
259
|
+
placeholder?: {
|
|
260
|
+
withheld_source: string;
|
|
261
|
+
reason?: 'not_served' | 'over_cap' | null;
|
|
262
|
+
} | null;
|
|
225
263
|
}
|
|
226
264
|
|
|
227
265
|
export interface TakoWebResult {
|
|
@@ -245,6 +283,10 @@ export interface TakoSearchResponse {
|
|
|
245
283
|
data?: {
|
|
246
284
|
cost_usd: number;
|
|
247
285
|
datasets: number;
|
|
286
|
+
data_points?: number | null;
|
|
287
|
+
} | null;
|
|
288
|
+
variable_cost?: {
|
|
289
|
+
cost_usd: number;
|
|
248
290
|
} | null;
|
|
249
291
|
} | null;
|
|
250
292
|
related?: Array<Record<string, unknown>> | null;
|
|
@@ -256,179 +298,168 @@ export type TakoSearchOutput = TakoSearchError | TakoSearchResponse;
|
|
|
256
298
|
|
|
257
299
|
const takoDataSourceInputSchema = () =>
|
|
258
300
|
z.object({
|
|
259
|
-
count: z
|
|
260
|
-
.number()
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
),
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
.enum(['
|
|
273
|
-
.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
),
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
node_ids: z
|
|
288
|
-
.array(z.string())
|
|
289
|
-
.optional()
|
|
290
|
-
.describe('Data Graph node IDs to prioritize. Maximum 20.'),
|
|
291
|
-
strict: z
|
|
292
|
-
.boolean()
|
|
293
|
-
.optional()
|
|
294
|
-
.describe(
|
|
295
|
-
'Only return cards matching node_ids. Requires a non-empty node_ids.',
|
|
296
|
-
),
|
|
301
|
+
count: z.describe(
|
|
302
|
+
z.optional(z.number()),
|
|
303
|
+
'Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge.',
|
|
304
|
+
),
|
|
305
|
+
include_contents: z.describe(
|
|
306
|
+
z.optional(z.boolean()),
|
|
307
|
+
'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.',
|
|
308
|
+
),
|
|
309
|
+
mode: z.describe(
|
|
310
|
+
z.optional(z.enum(['inline', 'url'])),
|
|
311
|
+
'Requested data delivery mode. Search card data is always inline.',
|
|
312
|
+
),
|
|
313
|
+
content_format: z.describe(
|
|
314
|
+
z.optional(z.enum(['card_json', 'csv', 'json_compact', 'json_records'])),
|
|
315
|
+
'Serialization for inlined card data.',
|
|
316
|
+
),
|
|
317
|
+
max_rows: z.describe(
|
|
318
|
+
z.optional(z.number()),
|
|
319
|
+
'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.',
|
|
320
|
+
),
|
|
321
|
+
node_ids: z.describe(
|
|
322
|
+
z.optional(z.array(z.string())),
|
|
323
|
+
'Data Graph node IDs to prioritize. Maximum 20.',
|
|
324
|
+
),
|
|
325
|
+
strict: z.describe(
|
|
326
|
+
z.optional(z.boolean()),
|
|
327
|
+
'Only return cards matching node_ids. Requires a non-empty node_ids.',
|
|
328
|
+
),
|
|
297
329
|
});
|
|
298
330
|
|
|
299
331
|
const takoWebSourceInputSchema = () =>
|
|
300
332
|
z.object({
|
|
301
|
-
count: z
|
|
302
|
-
.number()
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
include_contents: z
|
|
306
|
-
.boolean()
|
|
307
|
-
.
|
|
308
|
-
|
|
309
|
-
category: z
|
|
310
|
-
.enum(['finance', 'news', 'sports'])
|
|
311
|
-
.
|
|
312
|
-
|
|
313
|
-
include_domains: z
|
|
314
|
-
.array(z.string())
|
|
315
|
-
.
|
|
316
|
-
|
|
317
|
-
exclude_domains: z
|
|
318
|
-
.array(z.string())
|
|
319
|
-
.
|
|
320
|
-
|
|
321
|
-
snippet_max_chars: z
|
|
322
|
-
.number()
|
|
323
|
-
.
|
|
324
|
-
|
|
325
|
-
highlights: z
|
|
326
|
-
.boolean()
|
|
327
|
-
.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
),
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
.string()
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
'Keep results published on or after this ISO date (YYYY-MM-DD).',
|
|
342
|
-
),
|
|
343
|
-
published_before: z
|
|
344
|
-
.string()
|
|
345
|
-
.optional()
|
|
346
|
-
.describe(
|
|
347
|
-
'Keep results published on or before this ISO date (YYYY-MM-DD).',
|
|
348
|
-
),
|
|
333
|
+
count: z.describe(
|
|
334
|
+
z.optional(z.number()),
|
|
335
|
+
'Maximum number of web results to return (1-20).',
|
|
336
|
+
),
|
|
337
|
+
include_contents: z.describe(
|
|
338
|
+
z.optional(z.boolean()),
|
|
339
|
+
'Inline extracted web page text. This can add a data charge.',
|
|
340
|
+
),
|
|
341
|
+
category: z.describe(
|
|
342
|
+
z.optional(z.enum(['finance', 'news', 'sports'])),
|
|
343
|
+
'Optional web-result category filter.',
|
|
344
|
+
),
|
|
345
|
+
include_domains: z.describe(
|
|
346
|
+
z.optional(z.array(z.string())),
|
|
347
|
+
'Only return results from these bare domains.',
|
|
348
|
+
),
|
|
349
|
+
exclude_domains: z.describe(
|
|
350
|
+
z.optional(z.array(z.string())),
|
|
351
|
+
'Exclude results from these bare domains.',
|
|
352
|
+
),
|
|
353
|
+
snippet_max_chars: z.describe(
|
|
354
|
+
z.optional(z.number()),
|
|
355
|
+
'Maximum characters in each web-result snippet.',
|
|
356
|
+
),
|
|
357
|
+
highlights: z.describe(
|
|
358
|
+
z.optional(z.boolean()),
|
|
359
|
+
'Include highlighted passages in web results. Defaults to true in AI Gateway.',
|
|
360
|
+
),
|
|
361
|
+
article_content_max_chars: z.describe(
|
|
362
|
+
z.optional(z.number()),
|
|
363
|
+
'Maximum extracted characters per web page when including contents.',
|
|
364
|
+
),
|
|
365
|
+
published_after: z.describe(
|
|
366
|
+
z.optional(z.string()),
|
|
367
|
+
'Keep results published on or after this ISO date (YYYY-MM-DD).',
|
|
368
|
+
),
|
|
369
|
+
published_before: z.describe(
|
|
370
|
+
z.optional(z.string()),
|
|
371
|
+
'Keep results published on or before this ISO date (YYYY-MM-DD).',
|
|
372
|
+
),
|
|
349
373
|
});
|
|
350
374
|
|
|
351
375
|
const takoSearchInputSchema = lazySchema(() =>
|
|
352
376
|
zodSchema(
|
|
353
377
|
z.object({
|
|
354
|
-
query: z
|
|
355
|
-
.string()
|
|
356
|
-
.
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
378
|
+
query: z.describe(
|
|
379
|
+
z.string(),
|
|
380
|
+
'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.',
|
|
381
|
+
),
|
|
382
|
+
effort: z.describe(
|
|
383
|
+
z.optional(z.enum(['deep', 'fast', 'instant'])),
|
|
384
|
+
'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.',
|
|
385
|
+
),
|
|
386
|
+
sources: z.describe(
|
|
387
|
+
z.optional(
|
|
388
|
+
z.object({
|
|
389
|
+
data: z.optional(takoDataSourceInputSchema()),
|
|
390
|
+
web: z.optional(takoWebSourceInputSchema()),
|
|
391
|
+
}),
|
|
364
392
|
),
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
393
|
+
'Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched.',
|
|
394
|
+
),
|
|
395
|
+
location: z.describe(
|
|
396
|
+
z.optional(
|
|
397
|
+
z.object({
|
|
398
|
+
latitude: z.describe(z.number(), 'Latitude between -90 and 90.'),
|
|
399
|
+
longitude: z.describe(
|
|
400
|
+
z.number(),
|
|
401
|
+
'Longitude between -180 and 180.',
|
|
402
|
+
),
|
|
403
|
+
}),
|
|
373
404
|
),
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
.
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
.
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
.describe(
|
|
396
|
-
|
|
397
|
-
.boolean()
|
|
398
|
-
.optional()
|
|
399
|
-
.describe(
|
|
405
|
+
'End-user coordinates for localized results.',
|
|
406
|
+
),
|
|
407
|
+
country_code: z.describe(
|
|
408
|
+
z.optional(z.string()),
|
|
409
|
+
"Two-letter ISO 3166-1 country code, such as 'US'.",
|
|
410
|
+
),
|
|
411
|
+
locale: z.describe(
|
|
412
|
+
z.optional(z.string()),
|
|
413
|
+
"BCP-47 locale, such as 'en-US'.",
|
|
414
|
+
),
|
|
415
|
+
timezone: z.describe(
|
|
416
|
+
z.optional(z.string()),
|
|
417
|
+
"IANA timezone, such as 'America/New_York'.",
|
|
418
|
+
),
|
|
419
|
+
output_settings: z.describe(
|
|
420
|
+
z.optional(
|
|
421
|
+
z.object({
|
|
422
|
+
image_dark_mode: z.describe(
|
|
423
|
+
z.optional(z.boolean()),
|
|
424
|
+
'Render card preview images in dark mode.',
|
|
425
|
+
),
|
|
426
|
+
force_refresh: z.describe(
|
|
427
|
+
z.optional(z.boolean()),
|
|
400
428
|
'Instant-effort only. Request a refreshed instant result.',
|
|
401
429
|
),
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
.optional()
|
|
408
|
-
|
|
430
|
+
}),
|
|
431
|
+
),
|
|
432
|
+
'Controls card rendering in the search response.',
|
|
433
|
+
),
|
|
434
|
+
include_related: z.describe(
|
|
435
|
+
z.optional(z.number()),
|
|
436
|
+
'Maximum related search suggestions to include (1-20).',
|
|
437
|
+
),
|
|
409
438
|
}),
|
|
410
439
|
),
|
|
411
440
|
);
|
|
412
441
|
|
|
413
442
|
const takoDatasetCellSchema = () =>
|
|
414
|
-
z.union([z.boolean(), z.number(), z.string()])
|
|
443
|
+
z.nullable(z.union([z.boolean(), z.number(), z.string()]));
|
|
415
444
|
|
|
416
|
-
const takoResultContentSchema = () =>
|
|
417
|
-
z
|
|
418
|
-
.object({
|
|
419
|
-
content_format: z
|
|
420
|
-
.enum(['card_json', 'csv', 'json_compact', 'json_records'])
|
|
421
|
-
|
|
422
|
-
cost: z.
|
|
423
|
-
data: z.
|
|
424
|
-
records: z.
|
|
425
|
-
|
|
426
|
-
|
|
445
|
+
export const takoResultContentSchema = () =>
|
|
446
|
+
z.catchall(
|
|
447
|
+
z.object({
|
|
448
|
+
content_format: z.nullish(
|
|
449
|
+
z.enum(['card_json', 'csv', 'json_compact', 'json_records']),
|
|
450
|
+
),
|
|
451
|
+
cost: z.optional(z.number()),
|
|
452
|
+
data: z.nullish(z.string()),
|
|
453
|
+
records: z.nullish(
|
|
454
|
+
z.array(z.record(z.string(), takoDatasetCellSchema())),
|
|
455
|
+
),
|
|
456
|
+
dataset: z.nullish(
|
|
457
|
+
z.object({
|
|
427
458
|
columns: z.array(
|
|
428
459
|
z.object({
|
|
429
460
|
name: z.string(),
|
|
430
461
|
type: z.enum(['boolean', 'date', 'datetime', 'number', 'string']),
|
|
431
|
-
unit: z.
|
|
462
|
+
unit: z.nullish(z.string()),
|
|
432
463
|
}),
|
|
433
464
|
),
|
|
434
465
|
rows: z.array(z.array(takoDatasetCellSchema())),
|
|
@@ -438,131 +469,168 @@ const takoResultContentSchema = () =>
|
|
|
438
469
|
sources: z.array(
|
|
439
470
|
z.object({
|
|
440
471
|
name: z.string(),
|
|
441
|
-
index: z.enum(['data', 'web'])
|
|
472
|
+
index: z.optional(z.enum(['data', 'web'])),
|
|
442
473
|
}),
|
|
443
474
|
),
|
|
444
|
-
provenance: z.enum(['query', 'web_extraction'])
|
|
445
|
-
})
|
|
446
|
-
|
|
447
|
-
card_data: z.object({}).
|
|
448
|
-
card_data_schema: z.object({}).
|
|
449
|
-
url: z.
|
|
450
|
-
expires_at: z.
|
|
451
|
-
total_rows: z.
|
|
452
|
-
truncated: z.
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
475
|
+
provenance: z.optional(z.enum(['query', 'web_extraction'])),
|
|
476
|
+
}),
|
|
477
|
+
),
|
|
478
|
+
card_data: z.nullish(z.catchall(z.object({}), z.unknown())),
|
|
479
|
+
card_data_schema: z.nullish(z.catchall(z.object({}), z.unknown())),
|
|
480
|
+
url: z.nullish(z.string()),
|
|
481
|
+
expires_at: z.nullish(z.string()),
|
|
482
|
+
total_rows: z.nullish(z.number()),
|
|
483
|
+
truncated: z.optional(z.boolean()),
|
|
484
|
+
premium_rows: z.nullish(z.record(z.string(), z.number())),
|
|
485
|
+
redacted_cells: z.nullish(z.record(z.string(), z.array(z.number()))),
|
|
486
|
+
total_matching: z.nullish(z.number()),
|
|
487
|
+
export_pricing: z.nullish(
|
|
488
|
+
z.catchall(
|
|
489
|
+
z.object({
|
|
490
|
+
baseline_usd: z.number(),
|
|
491
|
+
free_rows: z.optional(z.number()),
|
|
492
|
+
max_rows_ceiling: z.number(),
|
|
493
|
+
row_cpm_usd: z.number(),
|
|
494
|
+
premium_row_cpm_usd: z.nullish(z.record(z.string(), z.number())),
|
|
495
|
+
variable_cost_max_usd: z.nullish(z.number()),
|
|
496
|
+
}),
|
|
497
|
+
z.unknown(),
|
|
498
|
+
),
|
|
499
|
+
),
|
|
500
|
+
manifest: z.nullish(
|
|
501
|
+
z.array(
|
|
463
502
|
z.object({
|
|
464
|
-
dtype: z
|
|
465
|
-
.enum(['boolean', 'date', 'datetime', 'number', 'string'])
|
|
466
|
-
|
|
467
|
-
entity: z.
|
|
468
|
-
metric: z.
|
|
469
|
-
name: z.
|
|
470
|
-
unit: z.
|
|
503
|
+
dtype: z.nullish(
|
|
504
|
+
z.enum(['boolean', 'date', 'datetime', 'number', 'string']),
|
|
505
|
+
),
|
|
506
|
+
entity: z.nullish(z.string()),
|
|
507
|
+
metric: z.nullish(z.string()),
|
|
508
|
+
name: z.nullish(z.string()),
|
|
509
|
+
unit: z.nullish(z.string()),
|
|
471
510
|
}),
|
|
472
|
-
)
|
|
473
|
-
|
|
474
|
-
})
|
|
475
|
-
.
|
|
511
|
+
),
|
|
512
|
+
),
|
|
513
|
+
}),
|
|
514
|
+
z.unknown(),
|
|
515
|
+
);
|
|
476
516
|
|
|
477
517
|
const takoCardSchema = () =>
|
|
478
|
-
z
|
|
479
|
-
.object({
|
|
480
|
-
card_id: z.
|
|
481
|
-
title: z.
|
|
482
|
-
description: z.
|
|
483
|
-
semantic_description: z.
|
|
484
|
-
webpage_url: z.
|
|
485
|
-
image_url: z.
|
|
486
|
-
embed_url: z.
|
|
487
|
-
sources: z
|
|
488
|
-
.array(
|
|
518
|
+
z.catchall(
|
|
519
|
+
z.object({
|
|
520
|
+
card_id: z.nullish(z.string()),
|
|
521
|
+
title: z.nullish(z.string()),
|
|
522
|
+
description: z.nullish(z.string()),
|
|
523
|
+
semantic_description: z.nullish(z.string()),
|
|
524
|
+
webpage_url: z.nullish(z.string()),
|
|
525
|
+
image_url: z.nullish(z.string()),
|
|
526
|
+
embed_url: z.nullish(z.string()),
|
|
527
|
+
sources: z.nullish(
|
|
528
|
+
z.array(
|
|
489
529
|
z.object({
|
|
490
|
-
source_name: z.
|
|
491
|
-
source_description: z.
|
|
530
|
+
source_name: z.nullish(z.string()),
|
|
531
|
+
source_description: z.nullish(z.string()),
|
|
492
532
|
source_index: z.enum(['data', 'web']),
|
|
493
|
-
source_text: z.
|
|
494
|
-
url: z.
|
|
533
|
+
source_text: z.nullish(z.string()),
|
|
534
|
+
url: z.nullish(z.string()),
|
|
495
535
|
}),
|
|
496
|
-
)
|
|
497
|
-
|
|
498
|
-
methodologies: z
|
|
499
|
-
.array(
|
|
536
|
+
),
|
|
537
|
+
),
|
|
538
|
+
methodologies: z.nullish(
|
|
539
|
+
z.array(
|
|
500
540
|
z.object({
|
|
501
|
-
methodology_name: z.
|
|
502
|
-
methodology_description: z.
|
|
541
|
+
methodology_name: z.nullable(z.string()),
|
|
542
|
+
methodology_description: z.nullable(z.string()),
|
|
503
543
|
}),
|
|
504
|
-
)
|
|
505
|
-
|
|
506
|
-
source_indexes: z.array(z.enum(['data', 'web']))
|
|
507
|
-
card_type: z.
|
|
508
|
-
relevance: z.enum(['High', 'Low', 'Medium'])
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
544
|
+
),
|
|
545
|
+
),
|
|
546
|
+
source_indexes: z.nullish(z.array(z.enum(['data', 'web']))),
|
|
547
|
+
card_type: z.nullish(z.string()),
|
|
548
|
+
relevance: z.nullish(z.enum(['High', 'Low', 'Medium'])),
|
|
549
|
+
relevance_score: z.nullish(z.number()),
|
|
550
|
+
content: z.nullish(takoResultContentSchema()),
|
|
551
|
+
exportable: z.optional(z.boolean()),
|
|
552
|
+
nodes: z.nullish(
|
|
553
|
+
z.array(
|
|
513
554
|
z.object({
|
|
514
555
|
id: z.string(),
|
|
515
556
|
type: z.enum(['entity', 'metric']),
|
|
516
557
|
name: z.string(),
|
|
517
|
-
description: z.
|
|
558
|
+
description: z.nullish(z.string()),
|
|
559
|
+
}),
|
|
560
|
+
),
|
|
561
|
+
),
|
|
562
|
+
metric_definitions: z.nullish(
|
|
563
|
+
z.array(z.object({ name: z.string(), definition: z.string() })),
|
|
564
|
+
),
|
|
565
|
+
data_freshness: z.nullish(
|
|
566
|
+
z.object({
|
|
567
|
+
coverage_end: z.nullish(z.string()),
|
|
568
|
+
data_as_of: z.nullish(z.string()),
|
|
569
|
+
last_updated: z.nullish(z.string()),
|
|
570
|
+
}),
|
|
571
|
+
),
|
|
572
|
+
placeholder: z.nullish(
|
|
573
|
+
z.catchall(
|
|
574
|
+
z.object({
|
|
575
|
+
withheld_source: z.string(),
|
|
576
|
+
reason: z.nullish(z.enum(['not_served', 'over_cap'])),
|
|
518
577
|
}),
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
.object({
|
|
526
|
-
coverage_end: z.string().nullish(),
|
|
527
|
-
data_as_of: z.string().nullish(),
|
|
528
|
-
last_updated: z.string().nullish(),
|
|
529
|
-
})
|
|
530
|
-
.nullish(),
|
|
531
|
-
})
|
|
532
|
-
.passthrough();
|
|
578
|
+
z.unknown(),
|
|
579
|
+
),
|
|
580
|
+
),
|
|
581
|
+
}),
|
|
582
|
+
z.unknown(),
|
|
583
|
+
);
|
|
533
584
|
|
|
534
585
|
const takoWebResultSchema = () =>
|
|
535
|
-
z
|
|
536
|
-
.object({
|
|
586
|
+
z.catchall(
|
|
587
|
+
z.object({
|
|
537
588
|
title: z.string(),
|
|
538
589
|
url: z.string(),
|
|
539
|
-
snippet: z.
|
|
540
|
-
source_name: z.
|
|
541
|
-
publish_date: z.
|
|
542
|
-
content:
|
|
543
|
-
})
|
|
544
|
-
.
|
|
590
|
+
snippet: z.nullish(z.string()),
|
|
591
|
+
source_name: z.nullish(z.string()),
|
|
592
|
+
publish_date: z.nullish(z.string()),
|
|
593
|
+
content: z.nullish(takoResultContentSchema()),
|
|
594
|
+
}),
|
|
595
|
+
z.unknown(),
|
|
596
|
+
);
|
|
545
597
|
|
|
546
598
|
const takoSearchOutputSchema = lazySchema(() =>
|
|
547
599
|
zodSchema(
|
|
548
600
|
z.union([
|
|
549
|
-
z
|
|
550
|
-
.object({
|
|
601
|
+
z.catchall(
|
|
602
|
+
z.object({
|
|
551
603
|
request_id: z.string(),
|
|
552
|
-
cards: z.array(takoCardSchema())
|
|
553
|
-
web_results: z.array(takoWebResultSchema())
|
|
554
|
-
usage: z
|
|
555
|
-
.
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
604
|
+
cards: z.optional(z.array(takoCardSchema())),
|
|
605
|
+
web_results: z.optional(z.array(takoWebResultSchema())),
|
|
606
|
+
usage: z.nullish(
|
|
607
|
+
z.catchall(
|
|
608
|
+
z.object({
|
|
609
|
+
total_cost_usd: z.number(),
|
|
610
|
+
compute: z.nullish(
|
|
611
|
+
z.catchall(z.object({ cost_usd: z.number() }), z.unknown()),
|
|
612
|
+
),
|
|
613
|
+
data: z.nullish(
|
|
614
|
+
z.catchall(
|
|
615
|
+
z.object({
|
|
616
|
+
cost_usd: z.number(),
|
|
617
|
+
datasets: z.number(),
|
|
618
|
+
data_points: z.nullish(z.number()),
|
|
619
|
+
}),
|
|
620
|
+
z.unknown(),
|
|
621
|
+
),
|
|
622
|
+
),
|
|
623
|
+
variable_cost: z.nullish(
|
|
624
|
+
z.catchall(z.object({ cost_usd: z.number() }), z.unknown()),
|
|
625
|
+
),
|
|
626
|
+
}),
|
|
627
|
+
z.unknown(),
|
|
628
|
+
),
|
|
629
|
+
),
|
|
630
|
+
related: z.nullish(z.array(z.catchall(z.object({}), z.unknown()))),
|
|
631
|
+
}),
|
|
632
|
+
z.unknown(),
|
|
633
|
+
),
|
|
566
634
|
gatewayToolErrorSchema(),
|
|
567
635
|
]),
|
|
568
636
|
),
|