@ai-sdk/gateway 4.0.119 → 4.0.121

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.
@@ -261,95 +261,99 @@ export interface TakoSearchError {
261
261
 
262
262
  export type TakoSearchOutput = TakoSearchError | TakoSearchResponse;
263
263
 
264
- const takoDataSourceInputSchema = z.object({
265
- count: z
266
- .number()
267
- .optional()
268
- .describe(
269
- 'Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge.',
270
- ),
271
- include_contents: z
272
- .boolean()
273
- .optional()
274
- .describe(
275
- '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.',
276
- ),
277
- mode: z
278
- .enum(['inline', 'url'])
279
- .optional()
280
- .describe(
281
- 'Requested data delivery mode. Search card data is always inline.',
282
- ),
283
- content_format: z
284
- .enum(['card_json', 'csv', 'json_compact', 'json_records'])
285
- .optional()
286
- .describe('Serialization for inlined card data.'),
287
- max_rows: z
288
- .number()
289
- .optional()
290
- .describe(
291
- '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.',
292
- ),
293
- node_ids: z
294
- .array(z.string())
295
- .optional()
296
- .describe('Data Graph node IDs to prioritize. Maximum 20.'),
297
- strict: z
298
- .boolean()
299
- .optional()
300
- .describe(
301
- 'Only return cards matching node_ids. Requires a non-empty node_ids.',
302
- ),
303
- });
264
+ const takoDataSourceInputSchema = () =>
265
+ z.object({
266
+ count: z
267
+ .number()
268
+ .optional()
269
+ .describe(
270
+ 'Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge.',
271
+ ),
272
+ include_contents: z
273
+ .boolean()
274
+ .optional()
275
+ .describe(
276
+ '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.',
277
+ ),
278
+ mode: z
279
+ .enum(['inline', 'url'])
280
+ .optional()
281
+ .describe(
282
+ 'Requested data delivery mode. Search card data is always inline.',
283
+ ),
284
+ content_format: z
285
+ .enum(['card_json', 'csv', 'json_compact', 'json_records'])
286
+ .optional()
287
+ .describe('Serialization for inlined card data.'),
288
+ max_rows: z
289
+ .number()
290
+ .optional()
291
+ .describe(
292
+ '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.',
293
+ ),
294
+ node_ids: z
295
+ .array(z.string())
296
+ .optional()
297
+ .describe('Data Graph node IDs to prioritize. Maximum 20.'),
298
+ strict: z
299
+ .boolean()
300
+ .optional()
301
+ .describe(
302
+ 'Only return cards matching node_ids. Requires a non-empty node_ids.',
303
+ ),
304
+ });
304
305
 
305
- const takoWebSourceInputSchema = z.object({
306
- count: z
307
- .number()
308
- .optional()
309
- .describe('Maximum number of web results to return (1-20).'),
310
- include_contents: z
311
- .boolean()
312
- .optional()
313
- .describe('Inline extracted web page text. This can add a data charge.'),
314
- category: z
315
- .enum(['finance', 'news', 'sports'])
316
- .optional()
317
- .describe('Optional web-result category filter.'),
318
- include_domains: z
319
- .array(z.string())
320
- .optional()
321
- .describe('Only return results from these bare domains.'),
322
- exclude_domains: z
323
- .array(z.string())
324
- .optional()
325
- .describe('Exclude results from these bare domains.'),
326
- snippet_max_chars: z
327
- .number()
328
- .optional()
329
- .describe('Maximum characters in each web-result snippet.'),
330
- highlights: z
331
- .boolean()
332
- .optional()
333
- .describe(
334
- 'Include highlighted passages in web results. Defaults to true in AI Gateway.',
335
- ),
336
- article_content_max_chars: z
337
- .number()
338
- .optional()
339
- .describe(
340
- 'Maximum extracted characters per web page when including contents.',
341
- ),
342
- published_after: z
343
- .string()
344
- .optional()
345
- .describe('Keep results published on or after this ISO date (YYYY-MM-DD).'),
346
- published_before: z
347
- .string()
348
- .optional()
349
- .describe(
350
- 'Keep results published on or before this ISO date (YYYY-MM-DD).',
351
- ),
352
- });
306
+ const takoWebSourceInputSchema = () =>
307
+ z.object({
308
+ count: z
309
+ .number()
310
+ .optional()
311
+ .describe('Maximum number of web results to return (1-20).'),
312
+ include_contents: z
313
+ .boolean()
314
+ .optional()
315
+ .describe('Inline extracted web page text. This can add a data charge.'),
316
+ category: z
317
+ .enum(['finance', 'news', 'sports'])
318
+ .optional()
319
+ .describe('Optional web-result category filter.'),
320
+ include_domains: z
321
+ .array(z.string())
322
+ .optional()
323
+ .describe('Only return results from these bare domains.'),
324
+ exclude_domains: z
325
+ .array(z.string())
326
+ .optional()
327
+ .describe('Exclude results from these bare domains.'),
328
+ snippet_max_chars: z
329
+ .number()
330
+ .optional()
331
+ .describe('Maximum characters in each web-result snippet.'),
332
+ highlights: z
333
+ .boolean()
334
+ .optional()
335
+ .describe(
336
+ 'Include highlighted passages in web results. Defaults to true in AI Gateway.',
337
+ ),
338
+ article_content_max_chars: z
339
+ .number()
340
+ .optional()
341
+ .describe(
342
+ 'Maximum extracted characters per web page when including contents.',
343
+ ),
344
+ published_after: z
345
+ .string()
346
+ .optional()
347
+ .describe(
348
+ 'Keep results published on or after this ISO date (YYYY-MM-DD).',
349
+ ),
350
+ published_before: z
351
+ .string()
352
+ .optional()
353
+ .describe(
354
+ 'Keep results published on or before this ISO date (YYYY-MM-DD).',
355
+ ),
356
+ });
353
357
 
354
358
  const takoSearchInputSchema = lazySchema(() =>
355
359
  zodSchema(
@@ -367,8 +371,8 @@ const takoSearchInputSchema = lazySchema(() =>
367
371
  ),
368
372
  sources: z
369
373
  .object({
370
- data: takoDataSourceInputSchema.optional(),
371
- web: takoWebSourceInputSchema.optional(),
374
+ data: takoDataSourceInputSchema().optional(),
375
+ web: takoWebSourceInputSchema().optional(),
372
376
  })
373
377
  .optional()
374
378
  .describe(
@@ -413,136 +417,138 @@ const takoSearchInputSchema = lazySchema(() =>
413
417
  ),
414
418
  );
415
419
 
416
- const takoDatasetCellSchema = z
417
- .union([z.boolean(), z.number(), z.string()])
418
- .nullable();
420
+ const takoDatasetCellSchema = () =>
421
+ z.union([z.boolean(), z.number(), z.string()]).nullable();
419
422
 
420
- const takoResultContentSchema = z
421
- .object({
422
- content_format: z
423
- .enum(['card_json', 'csv', 'json_compact', 'json_records'])
424
- .nullish(),
425
- cost: z.number().optional(),
426
- data: z.string().nullish(),
427
- records: z.array(z.record(z.string(), takoDatasetCellSchema)).nullish(),
428
- dataset: z
429
- .object({
430
- columns: z.array(
423
+ const takoResultContentSchema = () =>
424
+ z
425
+ .object({
426
+ content_format: z
427
+ .enum(['card_json', 'csv', 'json_compact', 'json_records'])
428
+ .nullish(),
429
+ cost: z.number().optional(),
430
+ data: z.string().nullish(),
431
+ records: z.array(z.record(z.string(), takoDatasetCellSchema())).nullish(),
432
+ dataset: z
433
+ .object({
434
+ columns: z.array(
435
+ z.object({
436
+ name: z.string(),
437
+ type: z.enum(['boolean', 'date', 'datetime', 'number', 'string']),
438
+ unit: z.string().nullish(),
439
+ }),
440
+ ),
441
+ rows: z.array(z.array(takoDatasetCellSchema())),
442
+ total_rows: z.number(),
443
+ truncated: z.boolean(),
444
+ ref: z.string(),
445
+ sources: z.array(
446
+ z.object({
447
+ name: z.string(),
448
+ index: z.enum(['data', 'web']).optional(),
449
+ }),
450
+ ),
451
+ provenance: z.enum(['query', 'web_extraction']).optional(),
452
+ })
453
+ .nullish(),
454
+ card_data: z.object({}).passthrough().nullish(),
455
+ card_data_schema: z.object({}).passthrough().nullish(),
456
+ url: z.string().nullish(),
457
+ expires_at: z.string().nullish(),
458
+ total_rows: z.number().nullish(),
459
+ truncated: z.boolean().optional(),
460
+ export_pricing: z
461
+ .object({
462
+ baseline_usd: z.number(),
463
+ free_rows: z.number(),
464
+ max_rows_ceiling: z.number(),
465
+ row_cpm_usd: z.number(),
466
+ })
467
+ .nullish(),
468
+ manifest: z
469
+ .array(
431
470
  z.object({
432
- name: z.string(),
433
- type: z.enum(['boolean', 'date', 'datetime', 'number', 'string']),
471
+ dtype: z
472
+ .enum(['boolean', 'date', 'datetime', 'number', 'string'])
473
+ .nullish(),
474
+ entity: z.string().nullish(),
475
+ metric: z.string().nullish(),
476
+ name: z.string().nullish(),
434
477
  unit: z.string().nullish(),
435
478
  }),
436
- ),
437
- rows: z.array(z.array(takoDatasetCellSchema)),
438
- total_rows: z.number(),
439
- truncated: z.boolean(),
440
- ref: z.string(),
441
- sources: z.array(
479
+ )
480
+ .nullish(),
481
+ })
482
+ .passthrough();
483
+
484
+ const takoCardSchema = () =>
485
+ z
486
+ .object({
487
+ card_id: z.string().nullish(),
488
+ title: z.string().nullish(),
489
+ description: z.string().nullish(),
490
+ semantic_description: z.string().nullish(),
491
+ webpage_url: z.string().nullish(),
492
+ image_url: z.string().nullish(),
493
+ embed_url: z.string().nullish(),
494
+ sources: z
495
+ .array(
496
+ z.object({
497
+ source_name: z.string().nullish(),
498
+ source_description: z.string().nullish(),
499
+ source_index: z.enum(['data', 'web']),
500
+ source_text: z.string().nullish(),
501
+ url: z.string().nullish(),
502
+ }),
503
+ )
504
+ .nullish(),
505
+ methodologies: z
506
+ .array(
507
+ z.object({
508
+ methodology_name: z.string().nullable(),
509
+ methodology_description: z.string().nullable(),
510
+ }),
511
+ )
512
+ .nullish(),
513
+ source_indexes: z.array(z.enum(['data', 'web'])).nullish(),
514
+ card_type: z.string().nullish(),
515
+ relevance: z.enum(['High', 'Low', 'Medium']).nullish(),
516
+ content: takoResultContentSchema().nullish(),
517
+ exportable: z.boolean().optional(),
518
+ nodes: z
519
+ .array(
442
520
  z.object({
521
+ id: z.string(),
522
+ type: z.enum(['entity', 'metric']),
443
523
  name: z.string(),
444
- index: z.enum(['data', 'web']).optional(),
524
+ description: z.string().nullish(),
445
525
  }),
446
- ),
447
- provenance: z.enum(['query', 'web_extraction']).optional(),
448
- })
449
- .nullish(),
450
- card_data: z.object({}).passthrough().nullish(),
451
- card_data_schema: z.object({}).passthrough().nullish(),
452
- url: z.string().nullish(),
453
- expires_at: z.string().nullish(),
454
- total_rows: z.number().nullish(),
455
- truncated: z.boolean().optional(),
456
- export_pricing: z
457
- .object({
458
- baseline_usd: z.number(),
459
- free_rows: z.number(),
460
- max_rows_ceiling: z.number(),
461
- row_cpm_usd: z.number(),
462
- })
463
- .nullish(),
464
- manifest: z
465
- .array(
466
- z.object({
467
- dtype: z
468
- .enum(['boolean', 'date', 'datetime', 'number', 'string'])
469
- .nullish(),
470
- entity: z.string().nullish(),
471
- metric: z.string().nullish(),
472
- name: z.string().nullish(),
473
- unit: z.string().nullish(),
474
- }),
475
- )
476
- .nullish(),
477
- })
478
- .passthrough();
479
-
480
- const takoCardSchema = z
481
- .object({
482
- card_id: z.string().nullish(),
483
- title: z.string().nullish(),
484
- description: z.string().nullish(),
485
- semantic_description: z.string().nullish(),
486
- webpage_url: z.string().nullish(),
487
- image_url: z.string().nullish(),
488
- embed_url: z.string().nullish(),
489
- sources: z
490
- .array(
491
- z.object({
492
- source_name: z.string().nullish(),
493
- source_description: z.string().nullish(),
494
- source_index: z.enum(['data', 'web']),
495
- source_text: z.string().nullish(),
496
- url: z.string().nullish(),
497
- }),
498
- )
499
- .nullish(),
500
- methodologies: z
501
- .array(
502
- z.object({
503
- methodology_name: z.string().nullable(),
504
- methodology_description: z.string().nullable(),
505
- }),
506
- )
507
- .nullish(),
508
- source_indexes: z.array(z.enum(['data', 'web'])).nullish(),
509
- card_type: z.string().nullish(),
510
- relevance: z.enum(['High', 'Low', 'Medium']).nullish(),
511
- content: takoResultContentSchema.nullish(),
512
- exportable: z.boolean().optional(),
513
- nodes: z
514
- .array(
515
- z.object({
516
- id: z.string(),
517
- type: z.enum(['entity', 'metric']),
518
- name: z.string(),
519
- description: z.string().nullish(),
520
- }),
521
- )
522
- .nullish(),
523
- metric_definitions: z
524
- .array(z.object({ name: z.string(), definition: z.string() }))
525
- .nullish(),
526
- data_freshness: z
527
- .object({
528
- coverage_end: z.string().nullish(),
529
- data_as_of: z.string().nullish(),
530
- last_updated: z.string().nullish(),
531
- })
532
- .nullish(),
533
- })
534
- .passthrough();
526
+ )
527
+ .nullish(),
528
+ metric_definitions: z
529
+ .array(z.object({ name: z.string(), definition: z.string() }))
530
+ .nullish(),
531
+ data_freshness: z
532
+ .object({
533
+ coverage_end: z.string().nullish(),
534
+ data_as_of: z.string().nullish(),
535
+ last_updated: z.string().nullish(),
536
+ })
537
+ .nullish(),
538
+ })
539
+ .passthrough();
535
540
 
536
- const takoWebResultSchema = z
537
- .object({
538
- title: z.string(),
539
- url: z.string(),
540
- snippet: z.string().nullish(),
541
- source_name: z.string().nullish(),
542
- publish_date: z.string().nullish(),
543
- content: takoResultContentSchema.nullish(),
544
- })
545
- .passthrough();
541
+ const takoWebResultSchema = () =>
542
+ z
543
+ .object({
544
+ title: z.string(),
545
+ url: z.string(),
546
+ snippet: z.string().nullish(),
547
+ source_name: z.string().nullish(),
548
+ publish_date: z.string().nullish(),
549
+ content: takoResultContentSchema().nullish(),
550
+ })
551
+ .passthrough();
546
552
 
547
553
  const takoSearchOutputSchema = lazySchema(() =>
548
554
  zodSchema(
@@ -550,8 +556,8 @@ const takoSearchOutputSchema = lazySchema(() =>
550
556
  z
551
557
  .object({
552
558
  request_id: z.string(),
553
- cards: z.array(takoCardSchema).optional(),
554
- web_results: z.array(takoWebResultSchema).optional(),
559
+ cards: z.array(takoCardSchema()).optional(),
560
+ web_results: z.array(takoWebResultSchema()).optional(),
555
561
  usage: z
556
562
  .object({
557
563
  total_cost_usd: z.number(),