ai-world-sdk 1.0.15 → 1.0.16
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.md +8 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,21 +46,21 @@ import { ChatGoogleGenerativeAI, ChatOpenAI, ChatAnthropic, HumanMessage, System
|
|
|
46
46
|
const geminiModel = new ChatGoogleGenerativeAI({
|
|
47
47
|
modelName: 'gemini-2.5-flash-image',
|
|
48
48
|
temperature: 0.7,
|
|
49
|
-
provider: 'gemini', // 或 'aihubmix'
|
|
49
|
+
provider: 'gemini', // 或 'aihubmix', 'api2img'
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
// GPT 模型(使用 aihubmix provider)
|
|
53
53
|
const gptModel = new ChatOpenAI({
|
|
54
54
|
modelName: 'gpt-4o-mini',
|
|
55
55
|
temperature: 0.7,
|
|
56
|
-
provider: 'aihubmix',
|
|
56
|
+
provider: 'aihubmix', // 或 'api2img'
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// Claude 模型(使用 aihubmix provider)
|
|
60
60
|
const claudeModel = new ChatAnthropic({
|
|
61
61
|
modelName: 'claude-3-sonnet-20240229',
|
|
62
62
|
temperature: 0.7,
|
|
63
|
-
provider: 'aihubmix',
|
|
63
|
+
provider: 'aihubmix', // 或 'api2img'
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
// 非流式调用
|
|
@@ -208,7 +208,7 @@ import { createChatModel } from 'ai-world-sdk';
|
|
|
208
208
|
// 根据模型名称自动选择正确的类
|
|
209
209
|
const model = createChatModel('gemini-2.5-flash-image', {
|
|
210
210
|
temperature: 0.7,
|
|
211
|
-
provider: 'gemini', // 或 'aihubmix', 'doubao'
|
|
211
|
+
provider: 'gemini', // 或 'aihubmix', 'api2img', 'doubao'
|
|
212
212
|
});
|
|
213
213
|
```
|
|
214
214
|
|
|
@@ -220,6 +220,7 @@ const model = createChatModel('gemini-2.5-flash-image', {
|
|
|
220
220
|
|
|
221
221
|
**Provider 参数说明:**
|
|
222
222
|
- `provider: 'aihubmix'` - 使用 aihubmix 聚合服务(推荐,支持所有模型)
|
|
223
|
+
- `provider: 'api2img'` - 使用 api2img 聚合服务(推荐,支持所有模型)
|
|
223
224
|
- `provider: 'gemini'` - 直接使用 Google Gemini API
|
|
224
225
|
- `provider: 'doubao'` - 使用豆包服务
|
|
225
226
|
|
|
@@ -330,6 +331,7 @@ const secondResponse = await client.chat({
|
|
|
330
331
|
|
|
331
332
|
- `provider: 'gemini'`(默认)- 直接使用 Google Gemini 官方 API
|
|
332
333
|
- `provider: 'aihubmix'` - 通过 aihubmix 代理服务调用,适合需要统一管理多个 API 的场景
|
|
334
|
+
- `provider: 'api2img'` - 通过 api2img 代理服务调用,适合需要统一管理多个 API 的场景
|
|
333
335
|
|
|
334
336
|
**模型对比:**
|
|
335
337
|
|
|
@@ -661,6 +663,7 @@ const response = await doubaoModel.invoke([
|
|
|
661
663
|
|----------|----------|------------|
|
|
662
664
|
| `aihubmix` | 多模型聚合,统一接口 | GPT、Gemini、Claude、Doubao 等 |
|
|
663
665
|
| `gemini` | 直接使用 Google Gemini API | 所有 Gemini 模型 |
|
|
666
|
+
| `api2img` | 使用 api2img 聚合服务 | 所有模型 |
|
|
664
667
|
| `doubao` | 使用豆包服务 | Doubao 系列模型 |
|
|
665
668
|
|
|
666
669
|
**推荐使用 `aihubmix` provider**,因为它提供了统一的接口和更好的模型选择灵活性。
|
|
@@ -1025,7 +1028,7 @@ for await (const chunk of client.streamDownload({
|
|
|
1025
1028
|
| Doubao | `doubao` 或 `aihubmix` | `doubao-pro-4k`, `doubao-seedream-4-5-251128` | `ChatOpenAI` |
|
|
1026
1029
|
|
|
1027
1030
|
**注意:**
|
|
1028
|
-
- 使用 `aihubmix` provider 可以访问所有模型,推荐用于多模型场景
|
|
1031
|
+
- 使用 `aihubmix` 或 `api2img` provider 可以访问所有模型,推荐用于多模型场景
|
|
1029
1032
|
- 使用特定 provider(如 `gemini`、`doubao`)会直接调用对应的官方 API
|
|
1030
1033
|
|
|
1031
1034
|
### 图像生成模型
|
package/package.json
CHANGED