@ai-sdk/gateway 4.0.141 → 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 +11 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +453 -424
- package/dist/index.js.map +1 -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.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 +1 -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 +277 -275
- package/src/zod.ts +47 -5
package/src/tool/tako-search.ts
CHANGED
|
@@ -193,6 +193,8 @@ export interface TakoResultContent {
|
|
|
193
193
|
total_matching?: number | null;
|
|
194
194
|
export_pricing?: {
|
|
195
195
|
baseline_usd: number;
|
|
196
|
+
/** @deprecated Always 0, and Tako will stop sending it. */
|
|
197
|
+
free_rows?: number;
|
|
196
198
|
max_rows_ceiling: number;
|
|
197
199
|
row_cpm_usd: number;
|
|
198
200
|
/** USD per 1,000 premium records by class, added to row_cpm_usd when premium. */
|
|
@@ -296,179 +298,168 @@ export type TakoSearchOutput = TakoSearchError | TakoSearchResponse;
|
|
|
296
298
|
|
|
297
299
|
const takoDataSourceInputSchema = () =>
|
|
298
300
|
z.object({
|
|
299
|
-
count: z
|
|
300
|
-
.number()
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
),
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
.enum(['
|
|
313
|
-
.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
),
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
node_ids: z
|
|
328
|
-
.array(z.string())
|
|
329
|
-
.optional()
|
|
330
|
-
.describe('Data Graph node IDs to prioritize. Maximum 20.'),
|
|
331
|
-
strict: z
|
|
332
|
-
.boolean()
|
|
333
|
-
.optional()
|
|
334
|
-
.describe(
|
|
335
|
-
'Only return cards matching node_ids. Requires a non-empty node_ids.',
|
|
336
|
-
),
|
|
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
|
+
),
|
|
337
329
|
});
|
|
338
330
|
|
|
339
331
|
const takoWebSourceInputSchema = () =>
|
|
340
332
|
z.object({
|
|
341
|
-
count: z
|
|
342
|
-
.number()
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
include_contents: z
|
|
346
|
-
.boolean()
|
|
347
|
-
.
|
|
348
|
-
|
|
349
|
-
category: z
|
|
350
|
-
.enum(['finance', 'news', 'sports'])
|
|
351
|
-
.
|
|
352
|
-
|
|
353
|
-
include_domains: z
|
|
354
|
-
.array(z.string())
|
|
355
|
-
.
|
|
356
|
-
|
|
357
|
-
exclude_domains: z
|
|
358
|
-
.array(z.string())
|
|
359
|
-
.
|
|
360
|
-
|
|
361
|
-
snippet_max_chars: z
|
|
362
|
-
.number()
|
|
363
|
-
.
|
|
364
|
-
|
|
365
|
-
highlights: z
|
|
366
|
-
.boolean()
|
|
367
|
-
.
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
),
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
.string()
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
'Keep results published on or after this ISO date (YYYY-MM-DD).',
|
|
382
|
-
),
|
|
383
|
-
published_before: z
|
|
384
|
-
.string()
|
|
385
|
-
.optional()
|
|
386
|
-
.describe(
|
|
387
|
-
'Keep results published on or before this ISO date (YYYY-MM-DD).',
|
|
388
|
-
),
|
|
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
|
+
),
|
|
389
373
|
});
|
|
390
374
|
|
|
391
375
|
const takoSearchInputSchema = lazySchema(() =>
|
|
392
376
|
zodSchema(
|
|
393
377
|
z.object({
|
|
394
|
-
query: z
|
|
395
|
-
.string()
|
|
396
|
-
.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
+
}),
|
|
404
392
|
),
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
+
}),
|
|
413
404
|
),
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
.
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
.
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
.describe(
|
|
436
|
-
|
|
437
|
-
.boolean()
|
|
438
|
-
.optional()
|
|
439
|
-
.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()),
|
|
440
428
|
'Instant-effort only. Request a refreshed instant result.',
|
|
441
429
|
),
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
.optional()
|
|
448
|
-
|
|
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
|
+
),
|
|
449
438
|
}),
|
|
450
439
|
),
|
|
451
440
|
);
|
|
452
441
|
|
|
453
442
|
const takoDatasetCellSchema = () =>
|
|
454
|
-
z.union([z.boolean(), z.number(), z.string()])
|
|
443
|
+
z.nullable(z.union([z.boolean(), z.number(), z.string()]));
|
|
455
444
|
|
|
456
445
|
export const takoResultContentSchema = () =>
|
|
457
|
-
z
|
|
458
|
-
.object({
|
|
459
|
-
content_format: z
|
|
460
|
-
.enum(['card_json', 'csv', 'json_compact', 'json_records'])
|
|
461
|
-
|
|
462
|
-
cost: z.
|
|
463
|
-
data: z.
|
|
464
|
-
records: z.
|
|
465
|
-
|
|
466
|
-
|
|
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({
|
|
467
458
|
columns: z.array(
|
|
468
459
|
z.object({
|
|
469
460
|
name: z.string(),
|
|
470
461
|
type: z.enum(['boolean', 'date', 'datetime', 'number', 'string']),
|
|
471
|
-
unit: z.
|
|
462
|
+
unit: z.nullish(z.string()),
|
|
472
463
|
}),
|
|
473
464
|
),
|
|
474
465
|
rows: z.array(z.array(takoDatasetCellSchema())),
|
|
@@ -478,157 +469,168 @@ export const takoResultContentSchema = () =>
|
|
|
478
469
|
sources: z.array(
|
|
479
470
|
z.object({
|
|
480
471
|
name: z.string(),
|
|
481
|
-
index: z.enum(['data', 'web'])
|
|
472
|
+
index: z.optional(z.enum(['data', 'web'])),
|
|
482
473
|
}),
|
|
483
474
|
),
|
|
484
|
-
provenance: z.enum(['query', 'web_extraction'])
|
|
485
|
-
})
|
|
486
|
-
|
|
487
|
-
card_data: z.object({}).
|
|
488
|
-
card_data_schema: z.object({}).
|
|
489
|
-
url: z.
|
|
490
|
-
expires_at: z.
|
|
491
|
-
total_rows: z.
|
|
492
|
-
truncated: z.
|
|
493
|
-
premium_rows: z.record(z.string(), z.number())
|
|
494
|
-
redacted_cells: z.record(z.string(), z.array(z.number()))
|
|
495
|
-
total_matching: z.
|
|
496
|
-
export_pricing: z
|
|
497
|
-
.
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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(
|
|
508
502
|
z.object({
|
|
509
|
-
dtype: z
|
|
510
|
-
.enum(['boolean', 'date', 'datetime', 'number', 'string'])
|
|
511
|
-
|
|
512
|
-
entity: z.
|
|
513
|
-
metric: z.
|
|
514
|
-
name: z.
|
|
515
|
-
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()),
|
|
516
510
|
}),
|
|
517
|
-
)
|
|
518
|
-
|
|
519
|
-
})
|
|
520
|
-
.
|
|
511
|
+
),
|
|
512
|
+
),
|
|
513
|
+
}),
|
|
514
|
+
z.unknown(),
|
|
515
|
+
);
|
|
521
516
|
|
|
522
517
|
const takoCardSchema = () =>
|
|
523
|
-
z
|
|
524
|
-
.object({
|
|
525
|
-
card_id: z.
|
|
526
|
-
title: z.
|
|
527
|
-
description: z.
|
|
528
|
-
semantic_description: z.
|
|
529
|
-
webpage_url: z.
|
|
530
|
-
image_url: z.
|
|
531
|
-
embed_url: z.
|
|
532
|
-
sources: z
|
|
533
|
-
.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(
|
|
534
529
|
z.object({
|
|
535
|
-
source_name: z.
|
|
536
|
-
source_description: z.
|
|
530
|
+
source_name: z.nullish(z.string()),
|
|
531
|
+
source_description: z.nullish(z.string()),
|
|
537
532
|
source_index: z.enum(['data', 'web']),
|
|
538
|
-
source_text: z.
|
|
539
|
-
url: z.
|
|
533
|
+
source_text: z.nullish(z.string()),
|
|
534
|
+
url: z.nullish(z.string()),
|
|
540
535
|
}),
|
|
541
|
-
)
|
|
542
|
-
|
|
543
|
-
methodologies: z
|
|
544
|
-
.array(
|
|
536
|
+
),
|
|
537
|
+
),
|
|
538
|
+
methodologies: z.nullish(
|
|
539
|
+
z.array(
|
|
545
540
|
z.object({
|
|
546
|
-
methodology_name: z.
|
|
547
|
-
methodology_description: z.
|
|
541
|
+
methodology_name: z.nullable(z.string()),
|
|
542
|
+
methodology_description: z.nullable(z.string()),
|
|
548
543
|
}),
|
|
549
|
-
)
|
|
550
|
-
|
|
551
|
-
source_indexes: z.array(z.enum(['data', 'web']))
|
|
552
|
-
card_type: z.
|
|
553
|
-
relevance: z.enum(['High', 'Low', 'Medium'])
|
|
554
|
-
relevance_score: z.
|
|
555
|
-
content:
|
|
556
|
-
exportable: z.
|
|
557
|
-
nodes: z
|
|
558
|
-
.array(
|
|
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(
|
|
559
554
|
z.object({
|
|
560
555
|
id: z.string(),
|
|
561
556
|
type: z.enum(['entity', 'metric']),
|
|
562
557
|
name: z.string(),
|
|
563
|
-
description: z.
|
|
558
|
+
description: z.nullish(z.string()),
|
|
564
559
|
}),
|
|
565
|
-
)
|
|
566
|
-
|
|
567
|
-
metric_definitions: z
|
|
568
|
-
.array(z.object({ name: z.string(), definition: z.string() }))
|
|
569
|
-
|
|
570
|
-
data_freshness: z
|
|
571
|
-
.object({
|
|
572
|
-
coverage_end: z.
|
|
573
|
-
data_as_of: z.
|
|
574
|
-
last_updated: z.
|
|
575
|
-
})
|
|
576
|
-
|
|
577
|
-
placeholder: z
|
|
578
|
-
.
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
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'])),
|
|
577
|
+
}),
|
|
578
|
+
z.unknown(),
|
|
579
|
+
),
|
|
580
|
+
),
|
|
581
|
+
}),
|
|
582
|
+
z.unknown(),
|
|
583
|
+
);
|
|
586
584
|
|
|
587
585
|
const takoWebResultSchema = () =>
|
|
588
|
-
z
|
|
589
|
-
.object({
|
|
586
|
+
z.catchall(
|
|
587
|
+
z.object({
|
|
590
588
|
title: z.string(),
|
|
591
589
|
url: z.string(),
|
|
592
|
-
snippet: z.
|
|
593
|
-
source_name: z.
|
|
594
|
-
publish_date: z.
|
|
595
|
-
content:
|
|
596
|
-
})
|
|
597
|
-
.
|
|
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
|
+
);
|
|
598
597
|
|
|
599
598
|
const takoSearchOutputSchema = lazySchema(() =>
|
|
600
599
|
zodSchema(
|
|
601
600
|
z.union([
|
|
602
|
-
z
|
|
603
|
-
.object({
|
|
601
|
+
z.catchall(
|
|
602
|
+
z.object({
|
|
604
603
|
request_id: z.string(),
|
|
605
|
-
cards: z.array(takoCardSchema())
|
|
606
|
-
web_results: z.array(takoWebResultSchema())
|
|
607
|
-
usage: z
|
|
608
|
-
.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
.
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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
|
+
),
|
|
632
634
|
gatewayToolErrorSchema(),
|
|
633
635
|
]),
|
|
634
636
|
),
|