@aihubmix/ai-sdk-provider 1.0.2 → 2.0.0
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 +15 -10
- package/LICENSE +201 -0
- package/dist/index.d.mts +55 -6
- package/dist/index.d.ts +55 -6
- package/dist/index.js +195 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +198 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
# @aihubmix/ai-sdk-provider
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 2dc97a3: 升级到 AI SDK v6
|
|
8
|
+
|
|
9
|
+
- 升级所有 AI SDK 依赖到 v6 兼容版本
|
|
10
|
+
- Provider 接口从 V2 升级到 V3 (LanguageModelV3, ProviderV3 等)
|
|
11
|
+
- 工具工厂函数 API 更新 (createProviderToolFactory)
|
|
12
|
+
- 添加 specificationVersion 和 embeddingModel 属性
|
|
13
|
+
- 版本号升级到 1.0.0
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
6
16
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- `
|
|
10
|
-
-
|
|
11
|
-
- `@ai-sdk/openai`: 3.0.13
|
|
12
|
-
- `@ai-sdk/google`: 3.0.10
|
|
13
|
-
- `@ai-sdk/provider-utils`: 4.0.8
|
|
14
|
-
- 🧪 Updated test suite to use vitest native mocking (removed deprecated createTestServer)
|
|
15
|
-
- ⬆️ Upgraded vitest to 4.0.17
|
|
17
|
+
- f3b2c86: - 添加 `aihubmixChatProviderOptionsSchema` 和 `aihubmixResponsesProviderOptionsSchema` 以支持所有 Vercel AI SDK OpenAI 提供商选项。
|
|
18
|
+
- 从主入口点导出选项类型和模式。
|
|
19
|
+
- 改进了 `gpt-5-pro` 和 `gpt-5-codex` 的模型配置。
|
|
20
|
+
- 通过更好的文件命名逻辑增强了 `AihubmixTranscriptionModel`。
|
|
16
21
|
|
|
17
22
|
## 1.0.1
|
|
18
23
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
2
1
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
4
4
|
|
|
5
5
|
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
6
6
|
/**
|
|
@@ -198,9 +198,58 @@ declare const aihubmixTools: {
|
|
|
198
198
|
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
/**
|
|
202
|
+
* OpenAI Chat 语言模型的 Provider Options Schema
|
|
203
|
+
* 与 Vercel AI SDK 的 openaiChatLanguageModelOptions 保持一致
|
|
204
|
+
*/
|
|
205
|
+
declare const aihubmixChatProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
206
|
+
logitBias?: Record<string, number> | undefined;
|
|
207
|
+
logprobs?: number | boolean | undefined;
|
|
208
|
+
parallelToolCalls?: boolean | undefined;
|
|
209
|
+
user?: string | undefined;
|
|
210
|
+
reasoningEffort?: "low" | "high" | "medium" | "none" | "minimal" | "xhigh" | undefined;
|
|
211
|
+
maxCompletionTokens?: number | undefined;
|
|
212
|
+
store?: boolean | undefined;
|
|
213
|
+
metadata?: Record<string, string> | undefined;
|
|
214
|
+
prediction?: Record<string, any> | undefined;
|
|
215
|
+
serviceTier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
216
|
+
strictJsonSchema?: boolean | undefined;
|
|
217
|
+
textVerbosity?: "low" | "high" | "medium" | undefined;
|
|
218
|
+
promptCacheKey?: string | undefined;
|
|
219
|
+
promptCacheRetention?: "in_memory" | "24h" | undefined;
|
|
220
|
+
safetyIdentifier?: string | undefined;
|
|
221
|
+
systemMessageMode?: "system" | "developer" | "remove" | undefined;
|
|
222
|
+
forceReasoning?: boolean | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
/**
|
|
225
|
+
* OpenAI Responses API 的 Provider Options Schema
|
|
226
|
+
*/
|
|
227
|
+
declare const aihubmixResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
228
|
+
conversation?: string | null | undefined;
|
|
229
|
+
include?: ("reasoning.encrypted_content" | "file_search_call.results" | "message.output_text.logprobs")[] | null | undefined;
|
|
230
|
+
instructions?: string | null | undefined;
|
|
231
|
+
logprobs?: number | boolean | undefined;
|
|
232
|
+
maxToolCalls?: number | null | undefined;
|
|
233
|
+
metadata?: any;
|
|
234
|
+
parallelToolCalls?: boolean | null | undefined;
|
|
235
|
+
previousResponseId?: string | null | undefined;
|
|
236
|
+
promptCacheKey?: string | null | undefined;
|
|
237
|
+
promptCacheRetention?: "in_memory" | "24h" | null | undefined;
|
|
238
|
+
reasoningEffort?: string | null | undefined;
|
|
239
|
+
reasoningSummary?: string | null | undefined;
|
|
240
|
+
safetyIdentifier?: string | null | undefined;
|
|
241
|
+
serviceTier?: "default" | "auto" | "flex" | "priority" | null | undefined;
|
|
242
|
+
store?: boolean | null | undefined;
|
|
243
|
+
strictJsonSchema?: boolean | null | undefined;
|
|
244
|
+
textVerbosity?: "low" | "high" | "medium" | null | undefined;
|
|
245
|
+
truncation?: "auto" | "disabled" | null | undefined;
|
|
246
|
+
user?: string | null | undefined;
|
|
247
|
+
systemMessageMode?: "system" | "developer" | "remove" | undefined;
|
|
248
|
+
forceReasoning?: boolean | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
type AihubmixChatProviderOptions = InferSchema<typeof aihubmixChatProviderOptionsSchema>;
|
|
251
|
+
type AihubmixResponsesProviderOptions = InferSchema<typeof aihubmixResponsesProviderOptionsSchema>;
|
|
252
|
+
type OpenAIProviderSettings = AihubmixChatProviderOptions;
|
|
204
253
|
interface AihubmixProvider extends ProviderV3 {
|
|
205
254
|
(deploymentId: string, settings?: OpenAIProviderSettings): LanguageModelV3;
|
|
206
255
|
readonly specificationVersion: 'v3';
|
|
@@ -227,4 +276,4 @@ interface AihubmixProviderSettings {
|
|
|
227
276
|
declare function createAihubmix(options?: AihubmixProviderSettings): AihubmixProvider;
|
|
228
277
|
declare const aihubmix: AihubmixProvider;
|
|
229
278
|
|
|
230
|
-
export { type AihubmixProvider, type AihubmixProviderSettings, aihubmix, createAihubmix };
|
|
279
|
+
export { type AihubmixChatProviderOptions, type AihubmixProvider, type AihubmixProviderSettings, type AihubmixResponsesProviderOptions, aihubmix, aihubmixChatProviderOptionsSchema, aihubmixResponsesProviderOptionsSchema, createAihubmix };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
2
1
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
4
4
|
|
|
5
5
|
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
6
6
|
/**
|
|
@@ -198,9 +198,58 @@ declare const aihubmixTools: {
|
|
|
198
198
|
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
/**
|
|
202
|
+
* OpenAI Chat 语言模型的 Provider Options Schema
|
|
203
|
+
* 与 Vercel AI SDK 的 openaiChatLanguageModelOptions 保持一致
|
|
204
|
+
*/
|
|
205
|
+
declare const aihubmixChatProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
206
|
+
logitBias?: Record<string, number> | undefined;
|
|
207
|
+
logprobs?: number | boolean | undefined;
|
|
208
|
+
parallelToolCalls?: boolean | undefined;
|
|
209
|
+
user?: string | undefined;
|
|
210
|
+
reasoningEffort?: "low" | "high" | "medium" | "none" | "minimal" | "xhigh" | undefined;
|
|
211
|
+
maxCompletionTokens?: number | undefined;
|
|
212
|
+
store?: boolean | undefined;
|
|
213
|
+
metadata?: Record<string, string> | undefined;
|
|
214
|
+
prediction?: Record<string, any> | undefined;
|
|
215
|
+
serviceTier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
216
|
+
strictJsonSchema?: boolean | undefined;
|
|
217
|
+
textVerbosity?: "low" | "high" | "medium" | undefined;
|
|
218
|
+
promptCacheKey?: string | undefined;
|
|
219
|
+
promptCacheRetention?: "in_memory" | "24h" | undefined;
|
|
220
|
+
safetyIdentifier?: string | undefined;
|
|
221
|
+
systemMessageMode?: "system" | "developer" | "remove" | undefined;
|
|
222
|
+
forceReasoning?: boolean | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
/**
|
|
225
|
+
* OpenAI Responses API 的 Provider Options Schema
|
|
226
|
+
*/
|
|
227
|
+
declare const aihubmixResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
228
|
+
conversation?: string | null | undefined;
|
|
229
|
+
include?: ("reasoning.encrypted_content" | "file_search_call.results" | "message.output_text.logprobs")[] | null | undefined;
|
|
230
|
+
instructions?: string | null | undefined;
|
|
231
|
+
logprobs?: number | boolean | undefined;
|
|
232
|
+
maxToolCalls?: number | null | undefined;
|
|
233
|
+
metadata?: any;
|
|
234
|
+
parallelToolCalls?: boolean | null | undefined;
|
|
235
|
+
previousResponseId?: string | null | undefined;
|
|
236
|
+
promptCacheKey?: string | null | undefined;
|
|
237
|
+
promptCacheRetention?: "in_memory" | "24h" | null | undefined;
|
|
238
|
+
reasoningEffort?: string | null | undefined;
|
|
239
|
+
reasoningSummary?: string | null | undefined;
|
|
240
|
+
safetyIdentifier?: string | null | undefined;
|
|
241
|
+
serviceTier?: "default" | "auto" | "flex" | "priority" | null | undefined;
|
|
242
|
+
store?: boolean | null | undefined;
|
|
243
|
+
strictJsonSchema?: boolean | null | undefined;
|
|
244
|
+
textVerbosity?: "low" | "high" | "medium" | null | undefined;
|
|
245
|
+
truncation?: "auto" | "disabled" | null | undefined;
|
|
246
|
+
user?: string | null | undefined;
|
|
247
|
+
systemMessageMode?: "system" | "developer" | "remove" | undefined;
|
|
248
|
+
forceReasoning?: boolean | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
type AihubmixChatProviderOptions = InferSchema<typeof aihubmixChatProviderOptionsSchema>;
|
|
251
|
+
type AihubmixResponsesProviderOptions = InferSchema<typeof aihubmixResponsesProviderOptionsSchema>;
|
|
252
|
+
type OpenAIProviderSettings = AihubmixChatProviderOptions;
|
|
204
253
|
interface AihubmixProvider extends ProviderV3 {
|
|
205
254
|
(deploymentId: string, settings?: OpenAIProviderSettings): LanguageModelV3;
|
|
206
255
|
readonly specificationVersion: 'v3';
|
|
@@ -227,4 +276,4 @@ interface AihubmixProviderSettings {
|
|
|
227
276
|
declare function createAihubmix(options?: AihubmixProviderSettings): AihubmixProvider;
|
|
228
277
|
declare const aihubmix: AihubmixProvider;
|
|
229
278
|
|
|
230
|
-
export { type AihubmixProvider, type AihubmixProviderSettings, aihubmix, createAihubmix };
|
|
279
|
+
export { type AihubmixChatProviderOptions, type AihubmixProvider, type AihubmixProviderSettings, type AihubmixResponsesProviderOptions, aihubmix, aihubmixChatProviderOptionsSchema, aihubmixResponsesProviderOptionsSchema, createAihubmix };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
aihubmix: () => aihubmix,
|
|
24
|
+
aihubmixChatProviderOptionsSchema: () => aihubmixChatProviderOptionsSchema,
|
|
25
|
+
aihubmixResponsesProviderOptionsSchema: () => aihubmixResponsesProviderOptionsSchema,
|
|
24
26
|
createAihubmix: () => createAihubmix
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -30,6 +32,7 @@ var import_internal = require("@ai-sdk/openai/internal");
|
|
|
30
32
|
var import_internal2 = require("@ai-sdk/anthropic/internal");
|
|
31
33
|
var import_internal3 = require("@ai-sdk/google/internal");
|
|
32
34
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
35
|
+
var import_zod6 = require("zod");
|
|
33
36
|
|
|
34
37
|
// src/tool/code-interpreter.ts
|
|
35
38
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -296,6 +299,191 @@ var aihubmixTools = {
|
|
|
296
299
|
};
|
|
297
300
|
|
|
298
301
|
// src/aihubmix-provider.ts
|
|
302
|
+
var aihubmixChatProviderOptionsSchema = (0, import_provider_utils6.lazySchema)(
|
|
303
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
304
|
+
import_zod6.z.object({
|
|
305
|
+
/**
|
|
306
|
+
* 修改指定 token 出现在生成内容中的概率
|
|
307
|
+
* 接受一个 JSON 对象,将 token ID(字符串形式)映射到 -100 到 100 之间的偏差值
|
|
308
|
+
*/
|
|
309
|
+
logitBias: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.number()).optional(),
|
|
310
|
+
/**
|
|
311
|
+
* 返回 token 的对数概率
|
|
312
|
+
* 设置为 true 返回生成 token 的对数概率
|
|
313
|
+
* 设置为数字返回前 n 个 token 的对数概率
|
|
314
|
+
*/
|
|
315
|
+
logprobs: import_zod6.z.union([import_zod6.z.boolean(), import_zod6.z.number()]).optional(),
|
|
316
|
+
/**
|
|
317
|
+
* 是否启用并行工具调用,默认为 true
|
|
318
|
+
*/
|
|
319
|
+
parallelToolCalls: import_zod6.z.boolean().optional(),
|
|
320
|
+
/**
|
|
321
|
+
* 代表终端用户的唯一标识符,帮助 OpenAI 监控和检测滥用行为
|
|
322
|
+
*/
|
|
323
|
+
user: import_zod6.z.string().optional(),
|
|
324
|
+
/**
|
|
325
|
+
* 推理模型的推理强度,默认为 `medium`
|
|
326
|
+
*/
|
|
327
|
+
reasoningEffort: import_zod6.z.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional(),
|
|
328
|
+
/**
|
|
329
|
+
* 生成的最大完成 token 数,适用于推理模型
|
|
330
|
+
*/
|
|
331
|
+
maxCompletionTokens: import_zod6.z.number().optional(),
|
|
332
|
+
/**
|
|
333
|
+
* 是否在 Responses API 中启用持久化
|
|
334
|
+
*/
|
|
335
|
+
store: import_zod6.z.boolean().optional(),
|
|
336
|
+
/**
|
|
337
|
+
* 与请求关联的元数据
|
|
338
|
+
*/
|
|
339
|
+
metadata: import_zod6.z.record(import_zod6.z.string().max(64), import_zod6.z.string().max(512)).optional(),
|
|
340
|
+
/**
|
|
341
|
+
* 预测模式的参数
|
|
342
|
+
*/
|
|
343
|
+
prediction: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.any()).optional(),
|
|
344
|
+
/**
|
|
345
|
+
* 请求的服务层级
|
|
346
|
+
* - 'auto': 默认服务层级
|
|
347
|
+
* - 'flex': 50% 更便宜但延迟更高(仅限 o3, o4-mini, gpt-5)
|
|
348
|
+
* - 'priority': 更快处理(需要企业版)
|
|
349
|
+
* - 'default': 标准定价和性能
|
|
350
|
+
*/
|
|
351
|
+
serviceTier: import_zod6.z.enum(["auto", "flex", "priority", "default"]).optional(),
|
|
352
|
+
/**
|
|
353
|
+
* 是否使用严格的 JSON schema 验证
|
|
354
|
+
* @default true
|
|
355
|
+
*/
|
|
356
|
+
strictJsonSchema: import_zod6.z.boolean().optional(),
|
|
357
|
+
/**
|
|
358
|
+
* 控制模型响应的详细程度
|
|
359
|
+
* 较低的值会产生更简洁的响应,较高的值会产生更详细的响应
|
|
360
|
+
*/
|
|
361
|
+
textVerbosity: import_zod6.z.enum(["low", "medium", "high"]).optional(),
|
|
362
|
+
/**
|
|
363
|
+
* 提示缓存的缓存键
|
|
364
|
+
*/
|
|
365
|
+
promptCacheKey: import_zod6.z.string().optional(),
|
|
366
|
+
/**
|
|
367
|
+
* 提示缓存的保留策略
|
|
368
|
+
* - 'in_memory': 默认,标准提示缓存行为
|
|
369
|
+
* - '24h': 扩展提示缓存,保持缓存前缀最多 24 小时
|
|
370
|
+
*/
|
|
371
|
+
promptCacheRetention: import_zod6.z.enum(["in_memory", "24h"]).optional(),
|
|
372
|
+
/**
|
|
373
|
+
* 用于帮助检测违反使用政策用户的稳定标识符
|
|
374
|
+
*/
|
|
375
|
+
safetyIdentifier: import_zod6.z.string().optional(),
|
|
376
|
+
/**
|
|
377
|
+
* 覆盖此模型的系统消息模式
|
|
378
|
+
* - 'system': 使用 'system' 角色(大多数模型的默认值)
|
|
379
|
+
* - 'developer': 使用 'developer' 角色(推理模型使用)
|
|
380
|
+
* - 'remove': 完全移除系统消息
|
|
381
|
+
*/
|
|
382
|
+
systemMessageMode: import_zod6.z.enum(["system", "developer", "remove"]).optional(),
|
|
383
|
+
/**
|
|
384
|
+
* 强制将此模型视为推理模型
|
|
385
|
+
* 适用于自定义 baseURL 的"隐形"推理模型
|
|
386
|
+
*/
|
|
387
|
+
forceReasoning: import_zod6.z.boolean().optional()
|
|
388
|
+
})
|
|
389
|
+
)
|
|
390
|
+
);
|
|
391
|
+
var aihubmixResponsesProviderOptionsSchema = (0, import_provider_utils6.lazySchema)(
|
|
392
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
393
|
+
import_zod6.z.object({
|
|
394
|
+
/**
|
|
395
|
+
* OpenAI 对话的 ID,用于继续对话
|
|
396
|
+
*/
|
|
397
|
+
conversation: import_zod6.z.string().nullish(),
|
|
398
|
+
/**
|
|
399
|
+
* 响应中包含的额外字段
|
|
400
|
+
*/
|
|
401
|
+
include: import_zod6.z.array(
|
|
402
|
+
import_zod6.z.enum([
|
|
403
|
+
"reasoning.encrypted_content",
|
|
404
|
+
"file_search_call.results",
|
|
405
|
+
"message.output_text.logprobs"
|
|
406
|
+
])
|
|
407
|
+
).nullish(),
|
|
408
|
+
/**
|
|
409
|
+
* 模型的指令
|
|
410
|
+
*/
|
|
411
|
+
instructions: import_zod6.z.string().nullish(),
|
|
412
|
+
/**
|
|
413
|
+
* 返回 token 的对数概率
|
|
414
|
+
*/
|
|
415
|
+
logprobs: import_zod6.z.union([import_zod6.z.boolean(), import_zod6.z.number().min(1).max(20)]).optional(),
|
|
416
|
+
/**
|
|
417
|
+
* 内置工具调用的最大总数
|
|
418
|
+
*/
|
|
419
|
+
maxToolCalls: import_zod6.z.number().nullish(),
|
|
420
|
+
/**
|
|
421
|
+
* 与生成关联的额外元数据
|
|
422
|
+
*/
|
|
423
|
+
metadata: import_zod6.z.any().nullish(),
|
|
424
|
+
/**
|
|
425
|
+
* 是否使用并行工具调用,默认为 true
|
|
426
|
+
*/
|
|
427
|
+
parallelToolCalls: import_zod6.z.boolean().nullish(),
|
|
428
|
+
/**
|
|
429
|
+
* 上一个响应的 ID,用于继续对话
|
|
430
|
+
*/
|
|
431
|
+
previousResponseId: import_zod6.z.string().nullish(),
|
|
432
|
+
/**
|
|
433
|
+
* 提示缓存键
|
|
434
|
+
*/
|
|
435
|
+
promptCacheKey: import_zod6.z.string().nullish(),
|
|
436
|
+
/**
|
|
437
|
+
* 提示缓存保留策略
|
|
438
|
+
*/
|
|
439
|
+
promptCacheRetention: import_zod6.z.enum(["in_memory", "24h"]).nullish(),
|
|
440
|
+
/**
|
|
441
|
+
* 推理模型的推理强度
|
|
442
|
+
*/
|
|
443
|
+
reasoningEffort: import_zod6.z.string().nullish(),
|
|
444
|
+
/**
|
|
445
|
+
* 控制推理摘要输出
|
|
446
|
+
*/
|
|
447
|
+
reasoningSummary: import_zod6.z.string().nullish(),
|
|
448
|
+
/**
|
|
449
|
+
* 安全监控的标识符
|
|
450
|
+
*/
|
|
451
|
+
safetyIdentifier: import_zod6.z.string().nullish(),
|
|
452
|
+
/**
|
|
453
|
+
* 请求的服务层级
|
|
454
|
+
*/
|
|
455
|
+
serviceTier: import_zod6.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
456
|
+
/**
|
|
457
|
+
* 是否存储生成内容,默认为 true
|
|
458
|
+
*/
|
|
459
|
+
store: import_zod6.z.boolean().nullish(),
|
|
460
|
+
/**
|
|
461
|
+
* 是否使用严格的 JSON schema 验证
|
|
462
|
+
*/
|
|
463
|
+
strictJsonSchema: import_zod6.z.boolean().nullish(),
|
|
464
|
+
/**
|
|
465
|
+
* 控制模型响应的详细程度
|
|
466
|
+
*/
|
|
467
|
+
textVerbosity: import_zod6.z.enum(["low", "medium", "high"]).nullish(),
|
|
468
|
+
/**
|
|
469
|
+
* 输出截断控制
|
|
470
|
+
*/
|
|
471
|
+
truncation: import_zod6.z.enum(["auto", "disabled"]).nullish(),
|
|
472
|
+
/**
|
|
473
|
+
* 代表终端用户的唯一标识符
|
|
474
|
+
*/
|
|
475
|
+
user: import_zod6.z.string().nullish(),
|
|
476
|
+
/**
|
|
477
|
+
* 系统消息模式
|
|
478
|
+
*/
|
|
479
|
+
systemMessageMode: import_zod6.z.enum(["system", "developer", "remove"]).optional(),
|
|
480
|
+
/**
|
|
481
|
+
* 强制将模型视为推理模型
|
|
482
|
+
*/
|
|
483
|
+
forceReasoning: import_zod6.z.boolean().optional()
|
|
484
|
+
})
|
|
485
|
+
)
|
|
486
|
+
);
|
|
299
487
|
var AihubmixTranscriptionModel = class extends import_internal.OpenAITranscriptionModel {
|
|
300
488
|
async doGenerate(options) {
|
|
301
489
|
if (options.mediaType) {
|
|
@@ -432,7 +620,8 @@ function createAihubmix(options = {}) {
|
|
|
432
620
|
provider: "aihubmix.chat",
|
|
433
621
|
url,
|
|
434
622
|
headers: getHeaders,
|
|
435
|
-
fetch: options.fetch
|
|
623
|
+
fetch: options.fetch,
|
|
624
|
+
fileIdPrefixes: ["file-"]
|
|
436
625
|
});
|
|
437
626
|
}
|
|
438
627
|
return new AihubmixOpenAIChatLanguageModel(deploymentName, {
|
|
@@ -459,7 +648,9 @@ function createAihubmix(options = {}) {
|
|
|
459
648
|
const createResponsesModel = (modelId) => new import_internal.OpenAIResponsesLanguageModel(modelId, {
|
|
460
649
|
provider: "aihubmix.responses",
|
|
461
650
|
url,
|
|
462
|
-
headers: getHeaders
|
|
651
|
+
headers: getHeaders,
|
|
652
|
+
fetch: options.fetch,
|
|
653
|
+
fileIdPrefixes: ["file-"]
|
|
463
654
|
});
|
|
464
655
|
const createImageModel = (modelId, settings = {}) => {
|
|
465
656
|
return new import_internal.OpenAIImageModel(modelId, {
|
|
@@ -513,6 +704,8 @@ var aihubmix = createAihubmix();
|
|
|
513
704
|
// Annotate the CommonJS export names for ESM import in node:
|
|
514
705
|
0 && (module.exports = {
|
|
515
706
|
aihubmix,
|
|
707
|
+
aihubmixChatProviderOptionsSchema,
|
|
708
|
+
aihubmixResponsesProviderOptionsSchema,
|
|
516
709
|
createAihubmix
|
|
517
710
|
});
|
|
518
711
|
//# sourceMappingURL=index.js.map
|