@ai-sdk/gateway 4.0.61 → 4.0.63
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 +14 -0
- package/dist/index.d.ts +234 -2
- package/dist/index.js +218 -2
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +106 -0
- package/package.json +3 -3
- 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/docs/00-ai-gateway.mdx
CHANGED
|
@@ -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.
|
|
4
|
+
"version": "4.0.63",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -32,12 +32,12 @@
|
|
|
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.
|
|
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.
|
|
40
|
+
"tsx": "4.23.12",
|
|
41
41
|
"typescript": "5.8.3",
|
|
42
42
|
"zod": "3.25.76",
|
|
43
43
|
"@ai-sdk/test-server": "2.0.1",
|
|
@@ -133,6 +133,7 @@ export type GatewayModelId =
|
|
|
133
133
|
| 'nvidia/nemotron-3-super-120b-a12b'
|
|
134
134
|
| 'nvidia/nemotron-3-ultra-550b-a55b'
|
|
135
135
|
| 'nvidia/nemotron-3.5-lightning'
|
|
136
|
+
| 'nvidia/nemotron-3.5-lightning-free'
|
|
136
137
|
| 'nvidia/nemotron-nano-12b-v2-vl'
|
|
137
138
|
| 'nvidia/nemotron-nano-9b-v2'
|
|
138
139
|
| 'openai/gpt-3.5-turbo'
|
package/src/gateway-tools.ts
CHANGED
|
@@ -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
|
};
|
|
@@ -10,6 +10,7 @@ export type GatewayVideoModelId =
|
|
|
10
10
|
| 'bfl/flux-3-video'
|
|
11
11
|
| 'bytedance/seedance-2.0'
|
|
12
12
|
| 'bytedance/seedance-2.0-fast'
|
|
13
|
+
| 'bytedance/seedance-2.0-mini'
|
|
13
14
|
| 'bytedance/seedance-2.5'
|
|
14
15
|
| 'bytedance/seedance-v1.0-pro'
|
|
15
16
|
| 'bytedance/seedance-v1.0-pro-fast'
|