@aihubmix/ai-sdk-provider 0.0.2 → 0.0.4
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/README.ja.md +301 -0
- package/README.md +169 -28
- package/README.zh.md +301 -0
- package/dist/index.d.mts +188 -12
- package/dist/index.d.ts +188 -12
- package/dist/index.js +267 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +265 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/LICENSE +0 -201
package/README.zh.md
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# AI SDK - Aihubmix Provider
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="README.md">🇺🇸 English</a> |
|
|
5
|
+
<a href="README.zh.md">🇨🇳 中文</a> |
|
|
6
|
+
<a href="README.ja.md">🇯🇵 日本語</a>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
> **🎉 10% 折扣!**
|
|
10
|
+
已内置app-code,使用此方式请求所有模型可享受 10% 折扣。
|
|
11
|
+
|
|
12
|
+
**[Aihubmix 官方网站](https://aihubmix.com/)** | **[模型广场](https://aihubmix.com/models)**
|
|
13
|
+
|
|
14
|
+
**[Aihubmix provider](https://v5.ai-sdk.dev/providers/community-providers/aihubmix)** 适用于 [AI SDK](https://ai-sdk.dev/docs)
|
|
15
|
+
一个网关,无限模型;一站式请求:OpenAI、Claude、Gemini、DeepSeek、Qwen 以及超过 500 个 AI 模型。
|
|
16
|
+
|
|
17
|
+
## 支持的功能
|
|
18
|
+
|
|
19
|
+
Aihubmix provider 支持以下 AI 功能:
|
|
20
|
+
|
|
21
|
+
- **文本生成**:使用各种模型进行聊天完成
|
|
22
|
+
- **流式文本**:实时文本流式传输
|
|
23
|
+
- **图像生成**:从文本提示创建图像
|
|
24
|
+
- **嵌入**:单个和批量文本嵌入
|
|
25
|
+
- **对象生成**:使用模式的结构化数据生成
|
|
26
|
+
- **流式对象**:实时结构化数据流式传输
|
|
27
|
+
- **语音合成**:文本转语音转换
|
|
28
|
+
- **转录**:语音转文本转换
|
|
29
|
+
- **工具**:网络搜索和其他工具
|
|
30
|
+
|
|
31
|
+
## 安装
|
|
32
|
+
|
|
33
|
+
Aihubmix 在 `@aihubmix/ai-sdk-provider` 模块中可用。您可以通过 [@aihubmix/ai-sdk-provider](https://www.npmjs.com/package/@aihubmix/ai-sdk-provider) 安装它
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm i @aihubmix/ai-sdk-provider
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Provider 实例
|
|
40
|
+
|
|
41
|
+
您可以从 `@aihubmix/ai-sdk-provider` 导入默认的 provider 实例 `aihubmix`:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 配置
|
|
48
|
+
|
|
49
|
+
将您的 Aihubmix API 密钥设置为环境变量:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export AIHUBMIX_API_KEY="your-api-key-here"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
或直接传递给 provider:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
59
|
+
|
|
60
|
+
const aihubmix = createAihubmix({
|
|
61
|
+
apiKey: 'your-api-key-here',
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 使用
|
|
66
|
+
|
|
67
|
+
首先,导入必要的函数:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
71
|
+
import {
|
|
72
|
+
generateText,
|
|
73
|
+
streamText,
|
|
74
|
+
generateImage,
|
|
75
|
+
embed,
|
|
76
|
+
embedMany,
|
|
77
|
+
generateObject,
|
|
78
|
+
streamObject,
|
|
79
|
+
generateSpeech,
|
|
80
|
+
transcribe
|
|
81
|
+
} from 'ai';
|
|
82
|
+
import { z } from 'zod';
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 生成文本
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
89
|
+
import { generateText } from 'ai';
|
|
90
|
+
|
|
91
|
+
const { text } = await generateText({
|
|
92
|
+
model: aihubmix('o4-mini'),
|
|
93
|
+
prompt: '为4个人写一个素食千层面食谱。',
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Claude 模型
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
101
|
+
import { generateText } from 'ai';
|
|
102
|
+
|
|
103
|
+
const { text } = await generateText({
|
|
104
|
+
model: aihubmix('claude-3-7-sonnet-20250219'),
|
|
105
|
+
prompt: '用简单的术语解释量子计算。',
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Gemini 模型
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
113
|
+
import { generateText } from 'ai';
|
|
114
|
+
|
|
115
|
+
const { text } = await generateText({
|
|
116
|
+
model: aihubmix('gemini-2.5-flash'),
|
|
117
|
+
prompt: '创建一个Python脚本来对数字列表进行排序。',
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 图像生成
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
125
|
+
import { generateImage } from 'ai';
|
|
126
|
+
|
|
127
|
+
const { image } = await generateImage({
|
|
128
|
+
model: aihubmix.image('gpt-image-1'),
|
|
129
|
+
prompt: '山间美丽的日落',
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 嵌入
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
137
|
+
import { embed } from 'ai';
|
|
138
|
+
|
|
139
|
+
const { embedding } = await embed({
|
|
140
|
+
model: aihubmix.embedding('text-embedding-ada-002'),
|
|
141
|
+
value: '你好,世界!',
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 转录
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
149
|
+
import { transcribe } from 'ai';
|
|
150
|
+
|
|
151
|
+
const { text } = await transcribe({
|
|
152
|
+
model: aihubmix.transcription('whisper-1'),
|
|
153
|
+
audio: audioFile,
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 流式文本
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
161
|
+
import { streamText } from 'ai';
|
|
162
|
+
|
|
163
|
+
const result = streamText({
|
|
164
|
+
model: aihubmix('gpt-3.5-turbo'),
|
|
165
|
+
prompt: '写一个关于机器人学习绘画的短故事。',
|
|
166
|
+
maxOutputTokens: 256,
|
|
167
|
+
temperature: 0.3,
|
|
168
|
+
maxRetries: 3,
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
let fullText = '';
|
|
172
|
+
for await (const textPart of result.textStream) {
|
|
173
|
+
fullText += textPart;
|
|
174
|
+
process.stdout.write(textPart);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
console.log('\n使用情况:', await result.usage);
|
|
178
|
+
console.log('完成原因:', await result.finishReason);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 生成对象
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
185
|
+
import { generateObject } from 'ai';
|
|
186
|
+
import { z } from 'zod';
|
|
187
|
+
|
|
188
|
+
const result = await generateObject({
|
|
189
|
+
model: aihubmix('gpt-4o-mini'),
|
|
190
|
+
schema: z.object({
|
|
191
|
+
recipe: z.object({
|
|
192
|
+
name: z.string(),
|
|
193
|
+
ingredients: z.array(
|
|
194
|
+
z.object({
|
|
195
|
+
name: z.string(),
|
|
196
|
+
amount: z.string(),
|
|
197
|
+
}),
|
|
198
|
+
),
|
|
199
|
+
steps: z.array(z.string()),
|
|
200
|
+
}),
|
|
201
|
+
}),
|
|
202
|
+
prompt: '生成一个千层面食谱。',
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
console.log(JSON.stringify(result.object.recipe, null, 2));
|
|
206
|
+
console.log('Token使用情况:', result.usage);
|
|
207
|
+
console.log('完成原因:', result.finishReason);
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 流式对象
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
214
|
+
import { streamObject } from 'ai';
|
|
215
|
+
import { z } from 'zod';
|
|
216
|
+
|
|
217
|
+
const result = await streamObject({
|
|
218
|
+
model: aihubmix('gpt-4o-mini'),
|
|
219
|
+
schema: z.object({
|
|
220
|
+
recipe: z.object({
|
|
221
|
+
name: z.string(),
|
|
222
|
+
ingredients: z.array(
|
|
223
|
+
z.object({
|
|
224
|
+
name: z.string(),
|
|
225
|
+
amount: z.string(),
|
|
226
|
+
}),
|
|
227
|
+
),
|
|
228
|
+
steps: z.array(z.string()),
|
|
229
|
+
}),
|
|
230
|
+
}),
|
|
231
|
+
prompt: '生成一个千层面食谱。',
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
for await (const objectPart of result.partialObjectStream) {
|
|
235
|
+
console.log(objectPart);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
console.log('Token使用情况:', result.usage);
|
|
239
|
+
console.log('最终对象:', result.object);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 批量嵌入
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
246
|
+
import { embedMany } from 'ai';
|
|
247
|
+
|
|
248
|
+
const { embeddings, usage } = await embedMany({
|
|
249
|
+
model: aihubmix.embedding('text-embedding-3-small'),
|
|
250
|
+
values: [
|
|
251
|
+
'海滩上的晴天',
|
|
252
|
+
'城市里的雨天下午',
|
|
253
|
+
'山间的雪夜',
|
|
254
|
+
],
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
console.log('嵌入向量:', embeddings);
|
|
258
|
+
console.log('使用情况:', usage);
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### 语音合成
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
265
|
+
import { generateSpeech } from 'ai';
|
|
266
|
+
|
|
267
|
+
const { audio } = await generateSpeech({
|
|
268
|
+
model: aihubmix.speech('tts-1'),
|
|
269
|
+
text: '你好,这是语音合成的测试。',
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// 保存音频文件
|
|
273
|
+
await saveAudioFile(audio);
|
|
274
|
+
console.log('音频生成成功:', audio);
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### 工具
|
|
278
|
+
|
|
279
|
+
Aihubmix provider 支持各种工具,包括网络搜索:
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
import { aihubmix } from '@aihubmix/ai-sdk-provider';
|
|
283
|
+
import { generateText } from 'ai';
|
|
284
|
+
|
|
285
|
+
const { text } = await generateText({
|
|
286
|
+
model: aihubmix('gpt-4'),
|
|
287
|
+
prompt: 'AI的最新发展是什么?',
|
|
288
|
+
tools: {
|
|
289
|
+
webSearchPreview: aihubmix.tools.webSearchPreview({
|
|
290
|
+
searchContextSize: 'high',
|
|
291
|
+
}),
|
|
292
|
+
},
|
|
293
|
+
});
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## 附加资源
|
|
297
|
+
|
|
298
|
+
- [Aihubmix Provider 仓库](https://github.com/inferera/aihubmix)
|
|
299
|
+
- [Aihubmix 文档](https://docs.aihubmix.com/en)
|
|
300
|
+
- [Aihubmix 控制台](https://aihubmix.com)
|
|
301
|
+
- [Aihubmix 商务合作](mailto:business@aihubmix.com)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,26 +1,202 @@
|
|
|
1
1
|
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
|
|
2
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
import { OpenAIProviderSettings } from '@ai-sdk/openai';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
7
|
+
/**
|
|
8
|
+
* Filters for the search.
|
|
9
|
+
*/
|
|
10
|
+
filters?: {
|
|
11
|
+
/**
|
|
12
|
+
* Allowed domains for the search.
|
|
13
|
+
* If not provided, all domains are allowed.
|
|
14
|
+
* Subdomains of the provided domains are allowed as well.
|
|
15
|
+
*/
|
|
16
|
+
allowedDomains?: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Search context size to use for the web search.
|
|
20
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
21
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
22
|
+
* - low: Least context, lowest cost, fastest response
|
|
23
|
+
*/
|
|
24
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
25
|
+
/**
|
|
26
|
+
* User location information to provide geographically relevant search results.
|
|
27
|
+
*/
|
|
9
28
|
userLocation?: {
|
|
10
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Type of location (always 'approximate')
|
|
31
|
+
*/
|
|
32
|
+
type: "approximate";
|
|
33
|
+
/**
|
|
34
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
35
|
+
*/
|
|
36
|
+
country?: string;
|
|
37
|
+
/**
|
|
38
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
39
|
+
*/
|
|
11
40
|
city?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
43
|
+
*/
|
|
12
44
|
region?: string;
|
|
13
|
-
|
|
45
|
+
/**
|
|
46
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
47
|
+
*/
|
|
14
48
|
timezone?: string;
|
|
15
49
|
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
50
|
+
}>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
54
|
+
*/
|
|
55
|
+
type OpenAIResponsesFileSearchToolComparisonFilter = {
|
|
56
|
+
/**
|
|
57
|
+
* The key to compare against the value.
|
|
58
|
+
*/
|
|
59
|
+
key: string;
|
|
60
|
+
/**
|
|
61
|
+
* Specifies the comparison operator: eq, ne, gt, gte, lt, lte.
|
|
62
|
+
*/
|
|
63
|
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
64
|
+
/**
|
|
65
|
+
* The value to compare against the attribute key; supports string, number, or boolean types.
|
|
66
|
+
*/
|
|
67
|
+
value: string | number | boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Combine multiple filters using and or or.
|
|
71
|
+
*/
|
|
72
|
+
type OpenAIResponsesFileSearchToolCompoundFilter = {
|
|
73
|
+
/**
|
|
74
|
+
* Type of operation: and or or.
|
|
75
|
+
*/
|
|
76
|
+
type: 'and' | 'or';
|
|
77
|
+
/**
|
|
78
|
+
* Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
|
|
79
|
+
*/
|
|
80
|
+
filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
|
|
21
81
|
};
|
|
82
|
+
|
|
22
83
|
declare const aihubmixTools: {
|
|
23
|
-
|
|
84
|
+
/**
|
|
85
|
+
* The Code Interpreter tool allows models to write and run Python code in a
|
|
86
|
+
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
87
|
+
* coding, and math.
|
|
88
|
+
*
|
|
89
|
+
* @param container - The container to use for the code interpreter.
|
|
90
|
+
*
|
|
91
|
+
* Must have name `code_interpreter`.
|
|
92
|
+
*/
|
|
93
|
+
codeInterpreter: (args?: {
|
|
94
|
+
container?: string | {
|
|
95
|
+
fileIds?: string[];
|
|
96
|
+
};
|
|
97
|
+
}) => _ai_sdk_provider_utils.Tool<{
|
|
98
|
+
code?: string | null;
|
|
99
|
+
containerId: string;
|
|
100
|
+
}, {
|
|
101
|
+
outputs?: Array<{
|
|
102
|
+
type: "logs";
|
|
103
|
+
logs: string;
|
|
104
|
+
} | {
|
|
105
|
+
type: "image";
|
|
106
|
+
url: string;
|
|
107
|
+
}> | null;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
111
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
112
|
+
* semantic and keyword search.
|
|
113
|
+
*
|
|
114
|
+
* Must have name `file_search`.
|
|
115
|
+
*
|
|
116
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
117
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
118
|
+
* @param ranking - The ranking options to use for the file search.
|
|
119
|
+
* @param filters - The filters to use for the file search.
|
|
120
|
+
*/
|
|
121
|
+
fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
122
|
+
queries: string[];
|
|
123
|
+
results: null | {
|
|
124
|
+
attributes: Record<string, unknown>;
|
|
125
|
+
fileId: string;
|
|
126
|
+
filename: string;
|
|
127
|
+
score: number;
|
|
128
|
+
text: string;
|
|
129
|
+
}[];
|
|
130
|
+
}, {
|
|
131
|
+
vectorStoreIds: string[];
|
|
132
|
+
maxNumResults?: number;
|
|
133
|
+
ranking?: {
|
|
134
|
+
ranker?: string;
|
|
135
|
+
scoreThreshold?: number;
|
|
136
|
+
};
|
|
137
|
+
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* The image generation tool allows you to generate images using a text prompt,
|
|
141
|
+
* and optionally image inputs. It leverages the GPT Image model,
|
|
142
|
+
* and automatically optimizes text inputs for improved performance.
|
|
143
|
+
*
|
|
144
|
+
* Must have name `image_generation`.
|
|
145
|
+
*
|
|
146
|
+
* @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
|
|
147
|
+
* @param quality - Rendering quality (e.g. low, medium, high)
|
|
148
|
+
* @param format - File output format
|
|
149
|
+
* @param compression - Compression level (0-100%) for JPEG and WebP formats
|
|
150
|
+
* @param background - Transparent or opaque
|
|
151
|
+
*/
|
|
152
|
+
imageGeneration: (args?: {
|
|
153
|
+
background?: "auto" | "opaque" | "transparent";
|
|
154
|
+
inputFidelity?: "low" | "high";
|
|
155
|
+
inputImageMask?: {
|
|
156
|
+
fileId?: string;
|
|
157
|
+
imageUrl?: string;
|
|
158
|
+
};
|
|
159
|
+
model?: string;
|
|
160
|
+
moderation?: "auto";
|
|
161
|
+
outputCompression?: number;
|
|
162
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
163
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
164
|
+
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
165
|
+
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
166
|
+
result: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Web search allows models to access up-to-date information from the internet
|
|
170
|
+
* and provide answers with sourced citations.
|
|
171
|
+
*
|
|
172
|
+
* Must have name `web_search_preview`.
|
|
173
|
+
*
|
|
174
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
175
|
+
* @param userLocation - The user location to use for the web search.
|
|
176
|
+
*
|
|
177
|
+
* @deprecated Use `webSearch` instead.
|
|
178
|
+
*/
|
|
179
|
+
webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
180
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
181
|
+
userLocation?: {
|
|
182
|
+
type: "approximate";
|
|
183
|
+
country?: string;
|
|
184
|
+
city?: string;
|
|
185
|
+
region?: string;
|
|
186
|
+
timezone?: string;
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* Web search allows models to access up-to-date information from the internet
|
|
191
|
+
* and provide answers with sourced citations.
|
|
192
|
+
*
|
|
193
|
+
* Must have name `web_search`.
|
|
194
|
+
*
|
|
195
|
+
* @param filters - The filters to use for the web search.
|
|
196
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
197
|
+
* @param userLocation - The user location to use for the web search.
|
|
198
|
+
*/
|
|
199
|
+
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
|
|
24
200
|
};
|
|
25
201
|
|
|
26
202
|
interface AihubmixProvider extends ProviderV2 {
|