@ai-sdk/gateway 4.0.60 → 4.0.62

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.
@@ -765,6 +765,112 @@ token-efficient content controls. Deep synthesis modes and generated summaries
765
765
  are intentionally not exposed yet because they have separate pricing from
766
766
  standard Search.
767
767
 
768
+ #### Tako Search
769
+
770
+ The Tako Search tool enables models to search the web and Tako's curated knowledge graph in a single call using [Tako's Search API](https://docs.tako.com/documentation/integrating-tako/search/overview). This tool is executed by the AI Gateway and returns token-efficient web excerpts, plus knowledge-graph results that carry structured data, premium source attribution, and an embed-ready visualization.
771
+
772
+ ```ts
773
+ import { gateway, generateText } from 'ai';
774
+
775
+ const result = await generateText({
776
+ model: 'openai/gpt-5.4-nano',
777
+ prompt: 'How has Nvidia quarterly revenue changed over the last two years?',
778
+ tools: {
779
+ tako_search: gateway.tools.takoSearch(),
780
+ },
781
+ });
782
+
783
+ console.log(result.text);
784
+ console.log('Tool calls:', JSON.stringify(result.toolCalls, null, 2));
785
+ console.log('Tool results:', JSON.stringify(result.toolResults, null, 2));
786
+ ```
787
+
788
+ Configure the search with effort, source selection, and localization defaults. These defaults override values the model includes in a tool call:
789
+
790
+ ```ts
791
+ import { gateway, generateText } from 'ai';
792
+
793
+ const result = await generateText({
794
+ model: 'openai/gpt-5.4-nano',
795
+ prompt: 'AMD vs. Nvidia headcount since 2013',
796
+ tools: {
797
+ tako_search: gateway.tools.takoSearch({
798
+ effort: 'fast',
799
+ sources: {
800
+ data: {
801
+ contentFormat: 'json_compact',
802
+ includeContents: true,
803
+ maxRows: 100,
804
+ },
805
+ web: {
806
+ count: 3,
807
+ },
808
+ },
809
+ countryCode: 'US',
810
+ locale: 'en-US',
811
+ }),
812
+ },
813
+ });
814
+
815
+ console.log(result.text);
816
+ ```
817
+
818
+ The Tako Search tool supports these optional configuration options:
819
+
820
+ - **effort** _'fast' | 'instant' | 'deep'_ - Search effort. `'fast'` is the balanced default, `'instant'` favors cached low-latency results, and `'deep'` broadens retrieval with reranking at higher cost and latency.
821
+ - **sources** _object_ - Omit to search both curated Tako data and the live web. When set, only source keys present are searched.
822
+ - **sources.web** _object_ - Configure web results:
823
+ - **count** _number_ - Maximum web results, 1-20.
824
+ - **category** _'finance' | 'news' | 'sports'_ - Restrict web results to one category.
825
+ - **includeDomains** / **excludeDomains** _string[]_ - Only return, or drop, results from these bare domains. Up to 20 each.
826
+ - **publishedAfter** / **publishedBefore** _string_ - Keep results published on or after, or on or before, this `YYYY-MM-DD` date.
827
+ - **snippetMaxChars** _number_ - Character cap on each result's text excerpt. Defaults to 4,000; maximum 20,000.
828
+ - **highlights** _boolean_ - Return query-relevant passages as each result's snippet instead of the opening text of the page. The snippet can hold multiple passages joined by `' ... '`, and a page with no highlight returns `snippet: null`. Defaults to `true` in the AI Gateway.
829
+ - **includeContents** _boolean_ - Inline each page's extracted full text in `content`. **articleContentMaxChars** caps it, defaulting to 30,000 characters (maximum 1,000,000).
830
+ - **sources.data** _object_ - Configure data results:
831
+ - **count** _number_ - Maximum data results, 1-20. Defaults to 5.
832
+ - **includeContents** _boolean_ - Inline each card's underlying rows in `content.dataset` as typed, unit-labeled columns.
833
+ - **contentFormat** _'json_compact' | 'json_records' | 'csv' | 'card_json'_ - Serialization for inlined card data. Defaults to `'json_compact'`.
834
+ - **maxRows** _number_ - Row cap for inlined card data. Omit to use your account's default inline cap (20 rows on the standard plan); maximum 2,000.
835
+ - **nodeIds** _string[]_ - Data Graph node IDs to prioritize. Up to 20.
836
+ - **strict** _boolean_ - Only return cards matching `nodeIds`. Requires at least one `nodeIds` value.
837
+ - **location** _object_ - End-user `{ latitude, longitude }` coordinates for localized results.
838
+ - **countryCode** _string_ - ISO 3166-1 alpha-2 country code, such as `'US'`.
839
+ - **locale** _string_ - BCP-47 locale, such as `'en-US'`.
840
+ - **timezone** _string_ - IANA timezone, such as `'America/New_York'`.
841
+ - **outputSettings** _object_ - Card rendering controls. `forceRefresh` is available only with `'instant'` effort.
842
+ - **includeRelated** _number_ - Number of related search suggestions to include (1-20).
843
+
844
+ For precise entity matching, quote a phrase in the query and optionally append a label: `"Tesla":PRODUCT price`. Tako treats the quoted phrase as one entity before searching.
845
+
846
+ The tool works with both `generateText` and `streamText`:
847
+
848
+ ```ts
849
+ import { gateway, streamText } from 'ai';
850
+
851
+ const result = streamText({
852
+ model: 'openai/gpt-5.4-nano',
853
+ prompt: 'What is the latest US inflation rate?',
854
+ tools: {
855
+ tako_search: gateway.tools.takoSearch(),
856
+ },
857
+ });
858
+
859
+ for await (const part of result.stream) {
860
+ switch (part.type) {
861
+ case 'text-delta':
862
+ process.stdout.write(part.text);
863
+ break;
864
+ case 'tool-call':
865
+ console.log('\nTool call:', JSON.stringify(part, null, 2));
866
+ break;
867
+ case 'tool-result':
868
+ console.log('\nTool result:', JSON.stringify(part, null, 2));
869
+ break;
870
+ }
871
+ }
872
+ ```
873
+
768
874
  #### Parallel Search
769
875
 
770
876
  The Parallel Search tool enables models to search the web using [Parallel AI's Search API](https://docs.parallel.ai/api-reference/search-beta/search). This tool is optimized for LLM consumption, returning relevant excerpts from web pages that can replace multiple keyword searches with a single call.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "4.0.60",
4
+ "version": "4.0.62",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "sideEffects": false,
@@ -32,16 +32,16 @@
32
32
  "dependencies": {
33
33
  "@vercel/oidc": "3.2.0",
34
34
  "@ai-sdk/provider": "4.0.7",
35
- "@ai-sdk/provider-utils": "5.0.28"
35
+ "@ai-sdk/provider-utils": "5.0.29"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "22.19.19",
39
39
  "tsup": "^8.5.1",
40
- "tsx": "4.19.2",
40
+ "tsx": "4.23.12",
41
41
  "typescript": "5.8.3",
42
42
  "zod": "3.25.76",
43
- "@ai-sdk/test-server": "2.0.1",
44
- "@vercel/ai-tsconfig": "0.0.0"
43
+ "@vercel/ai-tsconfig": "0.0.0",
44
+ "@ai-sdk/test-server": "2.0.1"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "zod": "^3.25.76 || ^4.1.8"
@@ -27,6 +27,6 @@ export type GatewayImageModelId =
27
27
  | 'recraft/recraft-v4.1-pro'
28
28
  | 'recraft/recraft-v4.1-utility'
29
29
  | 'recraft/recraft-v4.1-utility-pro'
30
- | 'xai/grok-imagine-image'
31
- | 'xai/grok-imagine-image-2.0'
30
+ | 'spacexai/grok-imagine-image'
31
+ | 'spacexai/grok-imagine-image-2.0'
32
32
  | (string & {});
@@ -199,23 +199,26 @@ export type GatewayModelId =
199
199
  | 'poolside/laguna-s-2.1-free'
200
200
  | 'sakana/fugu-ultra'
201
201
  | 'sakana/namazu'
202
+ | 'spacexai/grok-4.1-fast-non-reasoning'
203
+ | 'spacexai/grok-4.1-fast-reasoning'
204
+ | 'spacexai/grok-4.20-multi-agent'
205
+ | 'spacexai/grok-4.20-multi-agent-beta'
206
+ | 'spacexai/grok-4.20-non-reasoning'
207
+ | 'spacexai/grok-4.20-non-reasoning-beta'
208
+ | 'spacexai/grok-4.20-reasoning'
209
+ | 'spacexai/grok-4.20-reasoning-beta'
210
+ | 'spacexai/grok-4.3'
211
+ | 'spacexai/grok-4.5'
212
+ | 'spacexai/grok-4.6'
213
+ | 'spacexai/grok-build-0.1'
202
214
  | 'stepfun/step-3.5-flash'
203
215
  | 'stepfun/step-3.7-flash'
216
+ | 'tencent/hy-mt2-lite'
217
+ | 'tencent/hy-mt2-plus'
218
+ | 'tencent/hy-mt2-pro'
204
219
  | 'tencent/hy3'
205
220
  | 'thinkingmachines/inkling'
206
221
  | 'thinkingmachines/inkling-small'
207
- | 'xai/grok-4.1-fast-non-reasoning'
208
- | 'xai/grok-4.1-fast-reasoning'
209
- | 'xai/grok-4.20-multi-agent'
210
- | 'xai/grok-4.20-multi-agent-beta'
211
- | 'xai/grok-4.20-non-reasoning'
212
- | 'xai/grok-4.20-non-reasoning-beta'
213
- | 'xai/grok-4.20-reasoning'
214
- | 'xai/grok-4.20-reasoning-beta'
215
- | 'xai/grok-4.3'
216
- | 'xai/grok-4.5'
217
- | 'xai/grok-4.6'
218
- | 'xai/grok-build-0.1'
219
222
  | 'xiaomi/mimo-v2.5'
220
223
  | 'xiaomi/mimo-v2.5-pro'
221
224
  | 'zai/glm-4.5'
@@ -3,6 +3,6 @@ export type GatewayRealtimeModelId =
3
3
  | 'openai/gpt-realtime-2'
4
4
  | 'openai/gpt-realtime-2.1'
5
5
  | 'openai/gpt-realtime-mini'
6
- | 'xai/grok-voice-think-fast-1.0'
7
- | 'xai/grok-voice-think-fast-2.0'
6
+ | 'spacexai/grok-voice-think-fast-1.0'
7
+ | 'spacexai/grok-voice-think-fast-2.0'
8
8
  | (string & {});
@@ -7,5 +7,5 @@ export type GatewaySpeechModelId =
7
7
  | 'fish-audio/s2.1-pro-free'
8
8
  | 'openai/tts-1'
9
9
  | 'openai/tts-1-hd'
10
- | 'xai/grok-tts'
10
+ | 'spacexai/grok-tts'
11
11
  | (string & {});
@@ -1,6 +1,7 @@
1
1
  import { exaSearch } from './tool/exa-search';
2
2
  import { parallelSearch } from './tool/parallel-search';
3
3
  import { perplexitySearch } from './tool/perplexity-search';
4
+ import { takoSearch } from './tool/tako-search';
4
5
 
5
6
  /**
6
7
  * Gateway-specific provider-defined tools.
@@ -33,4 +34,14 @@ export const gatewayTools = {
33
34
  * domain, language, date range, and recency filters.
34
35
  */
35
36
  perplexitySearch,
37
+
38
+ /**
39
+ * Search the web and Tako's curated knowledge graph in one call for
40
+ * token-efficient web excerpts and structured data results grounded in
41
+ * premium sources, each with an embed-ready visualization.
42
+ *
43
+ * Supports effort, per-source web and data controls, localization, and inline
44
+ * contents for agents that need to reason over underlying data.
45
+ */
46
+ takoSearch,
36
47
  };
@@ -5,5 +5,5 @@ export type GatewayTranscriptionModelId =
5
5
  | 'openai/gpt-4o-transcribe'
6
6
  | 'openai/gpt-realtime-whisper'
7
7
  | 'openai/whisper-1'
8
- | 'xai/grok-stt'
8
+ | 'spacexai/grok-stt'
9
9
  | (string & {});
@@ -28,7 +28,7 @@ export type GatewayVideoModelId =
28
28
  | 'klingai/kling-v3.0-motion-control'
29
29
  | 'klingai/kling-v3.0-t2v'
30
30
  | 'minimax/minimax-h3'
31
- | 'xai/grok-imagine-video'
32
- | 'xai/grok-imagine-video-1.5'
33
- | 'xai/grok-imagine-video-1.5-preview'
31
+ | 'spacexai/grok-imagine-video'
32
+ | 'spacexai/grok-imagine-video-1.5'
33
+ | 'spacexai/grok-imagine-video-1.5-preview'
34
34
  | (string & {});