@arcships/aimux 0.1.5 → 0.2.1
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/LICENSE +21 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +27 -11
- package/dist/types/ContentPart.d.ts +6 -0
- package/dist/types/GenerateContent.d.ts +6 -0
- package/dist/types/GenerateTextOptions.d.ts +5 -0
- package/dist/types/ProviderName.d.ts +258 -0
- package/dist/types/ProviderName.js +262 -0
- package/dist/types/StreamPart.d.ts +6 -0
- package/dist/types/TimeoutConfiguration.d.ts +13 -0
- package/dist/types/TimeoutConfiguration.js +2 -0
- package/dist/types/ToolCall.d.ts +7 -0
- package/dist/types.d.ts +1 -0
- package/index.d.ts +91 -15
- package/index.js +65 -54
- package/package.json +8 -8
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ProviderName — GENERATED by `scripts/gen_provider_names.py`.
|
|
3
|
+
// Do not edit manually; single source of truth is `provider-registry.json`.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ProviderName = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Names of all built-in OpenAI-compatible providers.
|
|
8
|
+
* Use `ProviderName.groq` etc. as the `name` argument of `provider()`.
|
|
9
|
+
*/
|
|
10
|
+
exports.ProviderName = {
|
|
11
|
+
abacus: 'abacus',
|
|
12
|
+
abliteration_ai: 'abliteration_ai',
|
|
13
|
+
ai21: 'ai21',
|
|
14
|
+
ai302: 'ai302',
|
|
15
|
+
ai_router: 'ai_router',
|
|
16
|
+
aiand: 'aiand',
|
|
17
|
+
aibadgr: 'aibadgr',
|
|
18
|
+
aigc2d: 'aigc2d',
|
|
19
|
+
aihubmix: 'aihubmix',
|
|
20
|
+
ails: 'ails',
|
|
21
|
+
aiml: 'aiml',
|
|
22
|
+
aki_io: 'aki_io',
|
|
23
|
+
albert: 'albert',
|
|
24
|
+
alibaba: 'alibaba',
|
|
25
|
+
alibaba_coding_plan: 'alibaba_coding_plan',
|
|
26
|
+
alibaba_coding_plan_cn: 'alibaba_coding_plan_cn',
|
|
27
|
+
alibaba_token_plan: 'alibaba_token_plan',
|
|
28
|
+
alibaba_token_plan_cn: 'alibaba_token_plan_cn',
|
|
29
|
+
ambient: 'ambient',
|
|
30
|
+
anyapi: 'anyapi',
|
|
31
|
+
anyscale: 'anyscale',
|
|
32
|
+
apertis: 'apertis',
|
|
33
|
+
api2d: 'api2d',
|
|
34
|
+
api2gpt: 'api2gpt',
|
|
35
|
+
apiserpent: 'apiserpent',
|
|
36
|
+
atlascloud: 'atlascloud',
|
|
37
|
+
atomic_chat: 'atomic_chat',
|
|
38
|
+
auriko: 'auriko',
|
|
39
|
+
azure_ai: 'azure_ai',
|
|
40
|
+
baichuan: 'baichuan',
|
|
41
|
+
baidu: 'baidu',
|
|
42
|
+
baidu_v2: 'baidu_v2',
|
|
43
|
+
bailing: 'bailing',
|
|
44
|
+
baseten: 'baseten',
|
|
45
|
+
berget: 'berget',
|
|
46
|
+
bigmodel: 'bigmodel',
|
|
47
|
+
blueclaw: 'blueclaw',
|
|
48
|
+
bytedance: 'bytedance',
|
|
49
|
+
byteplus: 'byteplus',
|
|
50
|
+
bytez: 'bytez',
|
|
51
|
+
canopywave: 'canopywave',
|
|
52
|
+
cerebras: 'cerebras',
|
|
53
|
+
chatgpt: 'chatgpt',
|
|
54
|
+
cherryin: 'cherryin',
|
|
55
|
+
chutes: 'chutes',
|
|
56
|
+
clarifai: 'clarifai',
|
|
57
|
+
claudinio: 'claudinio',
|
|
58
|
+
cline_pass: 'cline_pass',
|
|
59
|
+
closeai: 'closeai',
|
|
60
|
+
cloudferro_sherlock: 'cloudferro_sherlock',
|
|
61
|
+
cloudflare: 'cloudflare',
|
|
62
|
+
cloudflare_workers_ai: 'cloudflare_workers_ai',
|
|
63
|
+
codestral: 'codestral',
|
|
64
|
+
cometapi: 'cometapi',
|
|
65
|
+
commandcode: 'commandcode',
|
|
66
|
+
compactifai: 'compactifai',
|
|
67
|
+
copilot: 'copilot',
|
|
68
|
+
cortecs: 'cortecs',
|
|
69
|
+
coze: 'coze',
|
|
70
|
+
crof: 'crof',
|
|
71
|
+
crossmodel: 'crossmodel',
|
|
72
|
+
crusoe: 'crusoe',
|
|
73
|
+
daoxe: 'daoxe',
|
|
74
|
+
darkbloom: 'darkbloom',
|
|
75
|
+
databricks: 'databricks',
|
|
76
|
+
datarobot: 'datarobot',
|
|
77
|
+
deepbricks: 'deepbricks',
|
|
78
|
+
deepinfra: 'deepinfra',
|
|
79
|
+
deepseek: 'deepseek',
|
|
80
|
+
digitalocean: 'digitalocean',
|
|
81
|
+
dinference: 'dinference',
|
|
82
|
+
doubao: 'doubao',
|
|
83
|
+
doubleword: 'doubleword',
|
|
84
|
+
drun: 'drun',
|
|
85
|
+
ebcloud: 'ebcloud',
|
|
86
|
+
embercloud: 'embercloud',
|
|
87
|
+
empiriolabs: 'empiriolabs',
|
|
88
|
+
evroc: 'evroc',
|
|
89
|
+
fastcrw: 'fastcrw',
|
|
90
|
+
fastgpt: 'fastgpt',
|
|
91
|
+
fastrouter: 'fastrouter',
|
|
92
|
+
featherless_ai: 'featherless_ai',
|
|
93
|
+
firepass: 'firepass',
|
|
94
|
+
fireworks: 'fireworks',
|
|
95
|
+
freemodel: 'freemodel',
|
|
96
|
+
friendliai: 'friendliai',
|
|
97
|
+
frogbot: 'frogbot',
|
|
98
|
+
galadriel: 'galadriel',
|
|
99
|
+
gdc: 'gdc',
|
|
100
|
+
gigachat: 'gigachat',
|
|
101
|
+
github: 'github',
|
|
102
|
+
gmi: 'gmi',
|
|
103
|
+
gmicloud: 'gmicloud',
|
|
104
|
+
gonka24: 'gonka24',
|
|
105
|
+
gradient_ai: 'gradient_ai',
|
|
106
|
+
groq: 'groq',
|
|
107
|
+
helicone: 'helicone',
|
|
108
|
+
heroku: 'heroku',
|
|
109
|
+
hetzner: 'hetzner',
|
|
110
|
+
hosted_vllm: 'hosted_vllm',
|
|
111
|
+
hpc_ai: 'hpc_ai',
|
|
112
|
+
hyperbolic: 'hyperbolic',
|
|
113
|
+
iflowcn: 'iflowcn',
|
|
114
|
+
inception: 'inception',
|
|
115
|
+
inceptron: 'inceptron',
|
|
116
|
+
inference_net: 'inference_net',
|
|
117
|
+
inferencehub: 'inferencehub',
|
|
118
|
+
inferx: 'inferx',
|
|
119
|
+
infinity: 'infinity',
|
|
120
|
+
io_net: 'io_net',
|
|
121
|
+
jiekou: 'jiekou',
|
|
122
|
+
kenari: 'kenari',
|
|
123
|
+
kilo: 'kilo',
|
|
124
|
+
kimi: 'kimi',
|
|
125
|
+
kimi_for_coding: 'kimi_for_coding',
|
|
126
|
+
kiro: 'kiro',
|
|
127
|
+
kluster_ai: 'kluster_ai',
|
|
128
|
+
krutrim: 'krutrim',
|
|
129
|
+
kuae_cloud_coding_plan: 'kuae_cloud_coding_plan',
|
|
130
|
+
lambda_ai: 'lambda_ai',
|
|
131
|
+
lemonade: 'lemonade',
|
|
132
|
+
lemonfox_ai: 'lemonfox_ai',
|
|
133
|
+
libertai: 'libertai',
|
|
134
|
+
lilac: 'lilac',
|
|
135
|
+
lingyiwanwu: 'lingyiwanwu',
|
|
136
|
+
llama: 'llama',
|
|
137
|
+
llamagate: 'llamagate',
|
|
138
|
+
llmgateway: 'llmgateway',
|
|
139
|
+
llmtr: 'llmtr',
|
|
140
|
+
longcat: 'longcat',
|
|
141
|
+
lucidquery: 'lucidquery',
|
|
142
|
+
lynkr: 'lynkr',
|
|
143
|
+
matterai: 'matterai',
|
|
144
|
+
meganova: 'meganova',
|
|
145
|
+
merge_gateway: 'merge_gateway',
|
|
146
|
+
meta: 'meta',
|
|
147
|
+
meta_llama: 'meta_llama',
|
|
148
|
+
mimo: 'mimo',
|
|
149
|
+
minimax: 'minimax',
|
|
150
|
+
minimax_cn: 'minimax_cn',
|
|
151
|
+
minimax_cn_coding_plan: 'minimax_cn_coding_plan',
|
|
152
|
+
minimax_coding_plan: 'minimax_coding_plan',
|
|
153
|
+
mira: 'mira',
|
|
154
|
+
mixlayer: 'mixlayer',
|
|
155
|
+
moark: 'moark',
|
|
156
|
+
modal: 'modal',
|
|
157
|
+
model_oracle_ai: 'model_oracle_ai',
|
|
158
|
+
modelscope: 'modelscope',
|
|
159
|
+
moonshotai: 'moonshotai',
|
|
160
|
+
moonshotai_cn: 'moonshotai_cn',
|
|
161
|
+
morph: 'morph',
|
|
162
|
+
nanogpt: 'nanogpt',
|
|
163
|
+
ncompass: 'ncompass',
|
|
164
|
+
nearai: 'nearai',
|
|
165
|
+
nebius: 'nebius',
|
|
166
|
+
neon: 'neon',
|
|
167
|
+
neuralwatt: 'neuralwatt',
|
|
168
|
+
nextbit: 'nextbit',
|
|
169
|
+
nlp_cloud: 'nlp_cloud',
|
|
170
|
+
nous_research: 'nous_research',
|
|
171
|
+
novita: 'novita',
|
|
172
|
+
nscale: 'nscale',
|
|
173
|
+
nvidia_nim: 'nvidia_nim',
|
|
174
|
+
oci: 'oci',
|
|
175
|
+
ofox: 'ofox',
|
|
176
|
+
ohmygpt: 'ohmygpt',
|
|
177
|
+
ollama_cloud: 'ollama_cloud',
|
|
178
|
+
openaimax: 'openaimax',
|
|
179
|
+
openaisb: 'openaisb',
|
|
180
|
+
opencode: 'opencode',
|
|
181
|
+
opencode_go: 'opencode_go',
|
|
182
|
+
opencode_zen: 'opencode_zen',
|
|
183
|
+
orcarouter: 'orcarouter',
|
|
184
|
+
ovhcloud: 'ovhcloud',
|
|
185
|
+
parasail: 'parasail',
|
|
186
|
+
perfxcloud: 'perfxcloud',
|
|
187
|
+
perplexity: 'perplexity',
|
|
188
|
+
perplexity_agent: 'perplexity_agent',
|
|
189
|
+
petals: 'petals',
|
|
190
|
+
pinstripes: 'pinstripes',
|
|
191
|
+
pioneer: 'pioneer',
|
|
192
|
+
poe: 'poe',
|
|
193
|
+
poolside: 'poolside',
|
|
194
|
+
portkey: 'portkey',
|
|
195
|
+
ppinfra: 'ppinfra',
|
|
196
|
+
predibase: 'predibase',
|
|
197
|
+
privatemode_ai: 'privatemode_ai',
|
|
198
|
+
publicai: 'publicai',
|
|
199
|
+
qihang_ai: 'qihang_ai',
|
|
200
|
+
qihoo360: 'qihoo360',
|
|
201
|
+
qiniu_ai: 'qiniu_ai',
|
|
202
|
+
regolo_ai: 'regolo_ai',
|
|
203
|
+
reka_ai: 'reka_ai',
|
|
204
|
+
requesty: 'requesty',
|
|
205
|
+
reve: 'reve',
|
|
206
|
+
routing_run: 'routing_run',
|
|
207
|
+
sakana: 'sakana',
|
|
208
|
+
sambanova: 'sambanova',
|
|
209
|
+
sarvam: 'sarvam',
|
|
210
|
+
scaleway: 'scaleway',
|
|
211
|
+
scx_ai: 'scx_ai',
|
|
212
|
+
siliconflow: 'siliconflow',
|
|
213
|
+
snowflake: 'snowflake',
|
|
214
|
+
snowflake_cortex: 'snowflake_cortex',
|
|
215
|
+
stackit: 'stackit',
|
|
216
|
+
stepfun: 'stepfun',
|
|
217
|
+
stepfun_ai_step_plan: 'stepfun_ai_step_plan',
|
|
218
|
+
stepfun_step_plan: 'stepfun_step_plan',
|
|
219
|
+
subconscious: 'subconscious',
|
|
220
|
+
submodel: 'submodel',
|
|
221
|
+
synthetic: 'synthetic',
|
|
222
|
+
tencent: 'tencent',
|
|
223
|
+
tencent_coding_plan: 'tencent_coding_plan',
|
|
224
|
+
tencent_token_plan: 'tencent_token_plan',
|
|
225
|
+
tencent_token_plan_enterprise_auto: 'tencent_token_plan_enterprise_auto',
|
|
226
|
+
tencent_token_plan_enterprise_pro: 'tencent_token_plan_enterprise_pro',
|
|
227
|
+
tencent_token_plan_general_personal: 'tencent_token_plan_general_personal',
|
|
228
|
+
tencent_token_plan_hy_personal: 'tencent_token_plan_hy_personal',
|
|
229
|
+
tencent_tokenhub: 'tencent_tokenhub',
|
|
230
|
+
tensormesh: 'tensormesh',
|
|
231
|
+
the_grid_ai: 'the_grid_ai',
|
|
232
|
+
thinkingmachines: 'thinkingmachines',
|
|
233
|
+
tinfoil: 'tinfoil',
|
|
234
|
+
togetherai: 'togetherai',
|
|
235
|
+
tokenflux: 'tokenflux',
|
|
236
|
+
tokenpony: 'tokenpony',
|
|
237
|
+
trustedrouter: 'trustedrouter',
|
|
238
|
+
tundra: 'tundra',
|
|
239
|
+
umans_ai: 'umans_ai',
|
|
240
|
+
unorouter: 'unorouter',
|
|
241
|
+
upstage: 'upstage',
|
|
242
|
+
v0: 'v0',
|
|
243
|
+
venice: 'venice',
|
|
244
|
+
vercel: 'vercel',
|
|
245
|
+
vivgrid: 'vivgrid',
|
|
246
|
+
volc_engine: 'volc_engine',
|
|
247
|
+
vultr: 'vultr',
|
|
248
|
+
wafer: 'wafer',
|
|
249
|
+
wandb: 'wandb',
|
|
250
|
+
xiaomi_token_plan_ams: 'xiaomi_token_plan_ams',
|
|
251
|
+
xiaomi_token_plan_cn: 'xiaomi_token_plan_cn',
|
|
252
|
+
xiaomi_token_plan_sgp: 'xiaomi_token_plan_sgp',
|
|
253
|
+
xiaomimimo: 'xiaomimimo',
|
|
254
|
+
xpersona: 'xpersona',
|
|
255
|
+
xunfei: 'xunfei',
|
|
256
|
+
zai: 'zai',
|
|
257
|
+
zai_coding_plan: 'zai_coding_plan',
|
|
258
|
+
zeldoc: 'zeldoc',
|
|
259
|
+
zenmux: 'zenmux',
|
|
260
|
+
zhipu_v4: 'zhipu_v4',
|
|
261
|
+
zhipuai_coding_plan: 'zhipuai_coding_plan',
|
|
262
|
+
};
|
|
@@ -79,6 +79,12 @@ export type StreamPart = {
|
|
|
79
79
|
* Whether the tool is dynamic (defined at runtime, e.g. MCP tools).
|
|
80
80
|
*/
|
|
81
81
|
dynamic?: boolean | null;
|
|
82
|
+
/**
|
|
83
|
+
* Provider-assigned thought signature (e.g. Google Gemini
|
|
84
|
+
* `thoughtSignature`). Must be echoed back verbatim on the follow-up
|
|
85
|
+
* turn when the tool result is sent.
|
|
86
|
+
*/
|
|
87
|
+
thought_signature?: string | null;
|
|
82
88
|
provider_metadata?: JsonValue | null;
|
|
83
89
|
};
|
|
84
90
|
} | {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-call timeout configuration.
|
|
3
|
+
*
|
|
4
|
+
* Aligned with V4 `LanguageModelV4CallOptions.timeout`
|
|
5
|
+
* (`TimeoutConfiguration`). All values are milliseconds; `None` disables the
|
|
6
|
+
* corresponding limit. A `total` timeout also covers retry backoff and the
|
|
7
|
+
* whole streamed response.
|
|
8
|
+
*/
|
|
9
|
+
export type TimeoutConfiguration = {
|
|
10
|
+
total_ms: number | null;
|
|
11
|
+
first_chunk_ms: number | null;
|
|
12
|
+
chunk_ms: number | null;
|
|
13
|
+
};
|
package/dist/types/ToolCall.d.ts
CHANGED
|
@@ -23,4 +23,11 @@ export type ToolCall = {
|
|
|
23
23
|
* Whether the tool is dynamic (defined at runtime, e.g. MCP tools).
|
|
24
24
|
*/
|
|
25
25
|
dynamic?: boolean | null;
|
|
26
|
+
/**
|
|
27
|
+
* Provider-assigned thought signature (e.g. Google Gemini
|
|
28
|
+
* `thoughtSignature`). Must be echoed back verbatim on the follow-up turn
|
|
29
|
+
* when the tool result is sent; thinking models reject the request
|
|
30
|
+
* otherwise.
|
|
31
|
+
*/
|
|
32
|
+
thought_signature?: string | null;
|
|
26
33
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export type * from './types/SpeechRequest';
|
|
|
52
52
|
export type * from './types/SpeechResponse';
|
|
53
53
|
export type * from './types/SpeechResult';
|
|
54
54
|
export type * from './types/StreamPart';
|
|
55
|
+
export type * from './types/TimeoutConfiguration';
|
|
55
56
|
export type * from './types/TokenUsage';
|
|
56
57
|
export type * from './types/Tool';
|
|
57
58
|
export type * from './types/ToolCall';
|
package/index.d.ts
CHANGED
|
@@ -9,6 +9,25 @@ declare global {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* A bridge from a JS `AbortSignal` to the core's runtime cancellation.
|
|
14
|
+
*
|
|
15
|
+
* napi's own `AbortSignal` is not `Send` (it holds `Rc`), so it cannot be a
|
|
16
|
+
* parameter of an async napi method. This class is created synchronously
|
|
17
|
+
* (registering the abort callback on the JS thread) and then passed to
|
|
18
|
+
* `generateText` / `streamText` — it only holds an `Arc` and is `Send`.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const bridge = signal ? new AbortBridge(signal) : undefined
|
|
22
|
+
* await model.generateText(prompt, options, bridge)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class AbortBridge {
|
|
26
|
+
constructor(signal: AbortSignal)
|
|
27
|
+
/** Returns `true` once the underlying JS signal has been aborted. */
|
|
28
|
+
aborted(): boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
12
31
|
export declare class EmbeddingModel {
|
|
13
32
|
/**
|
|
14
33
|
* Generate embeddings. `values_json` is a JSON array of strings.
|
|
@@ -30,9 +49,10 @@ export declare class Files {
|
|
|
30
49
|
export declare class ImageModel {
|
|
31
50
|
/**
|
|
32
51
|
* Generate images. `opts_json` is JSON-serialized ImageCallOptions.
|
|
33
|
-
*
|
|
52
|
+
* `bridge` — optional `AbortBridge`; aborting the wrapped signal cancels
|
|
53
|
+
* the call. Returns JSON-serialized ImageResult (images as base64 in JSON).
|
|
34
54
|
*/
|
|
35
|
-
generate(optsJson: string): Promise<string>
|
|
55
|
+
generate(optsJson: string, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
36
56
|
}
|
|
37
57
|
|
|
38
58
|
export declare class Model {
|
|
@@ -41,41 +61,46 @@ export declare class Model {
|
|
|
41
61
|
*
|
|
42
62
|
* `prompt` — a JSON string: bare prompt (`"text"` or `[{...}]`) or `{"prompt": ...}`.
|
|
43
63
|
* `options` — optional JSON-serialized `GenerateTextOptions`.
|
|
64
|
+
* `bridge` — optional `AbortBridge` (wrap a JS `AbortSignal` in one);
|
|
65
|
+
* aborting the signal cancels the call.
|
|
44
66
|
* Returns a JSON-serialized `GenerateTextResult`.
|
|
45
67
|
*/
|
|
46
|
-
generateText(prompt: string, options?: string | undefined | null): Promise<string>
|
|
68
|
+
generateText(prompt: string, options?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
47
69
|
/**
|
|
48
70
|
* Stream text from the model.
|
|
49
71
|
*
|
|
50
72
|
* Returns an `AsyncGenerator<string>` yielding `StreamPart` JSON strings.
|
|
51
73
|
* Use `for await (const part of model.streamText(...))` to consume.
|
|
52
74
|
*/
|
|
53
|
-
streamText(prompt: string, options?: string | undefined | null): Promise<AsyncGenerator<string>>
|
|
75
|
+
streamText(prompt: string, options?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<AsyncGenerator<string>>
|
|
54
76
|
}
|
|
55
77
|
|
|
56
78
|
export declare class RerankingModel {
|
|
57
79
|
/**
|
|
58
80
|
* Rerank documents. `query` is the search query, `docs_json` is a JSON
|
|
59
81
|
* array of documents, `opts_json` is optional JSON options.
|
|
60
|
-
*
|
|
82
|
+
* `bridge` — optional `AbortBridge`; aborting the wrapped signal cancels
|
|
83
|
+
* the call. Returns JSON-serialized RerankingResult.
|
|
61
84
|
*/
|
|
62
|
-
rerank(query: string, docsJson: string, optsJson?: string | undefined | null): Promise<string>
|
|
85
|
+
rerank(query: string, docsJson: string, optsJson?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
63
86
|
}
|
|
64
87
|
|
|
65
88
|
export declare class SearchModel {
|
|
66
89
|
/**
|
|
67
90
|
* Search. `query` is the search query, `opts_json` is optional JSON options.
|
|
68
|
-
*
|
|
91
|
+
* `bridge` — optional `AbortBridge`; aborting the wrapped signal cancels
|
|
92
|
+
* the call. Returns JSON-serialized SearchResult.
|
|
69
93
|
*/
|
|
70
|
-
search(query: string, optsJson?: string | undefined | null): Promise<string>
|
|
94
|
+
search(query: string, optsJson?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
71
95
|
}
|
|
72
96
|
|
|
73
97
|
export declare class SpeechModel {
|
|
74
98
|
/**
|
|
75
99
|
* Generate speech audio. `opts_json` is JSON-serialized SpeechCallOptions.
|
|
76
|
-
*
|
|
100
|
+
* `bridge` — optional `AbortBridge`; aborting the wrapped signal cancels
|
|
101
|
+
* the call. Returns JSON-serialized SpeechResult (audio as base64 in JSON).
|
|
77
102
|
*/
|
|
78
|
-
generate(optsJson: string): Promise<string>
|
|
103
|
+
generate(optsJson: string, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
79
104
|
}
|
|
80
105
|
|
|
81
106
|
/**
|
|
@@ -99,31 +124,58 @@ export declare class TranscriptionModel {
|
|
|
99
124
|
/**
|
|
100
125
|
* Transcribe audio. `audio_base64` is base64-encoded audio data.
|
|
101
126
|
* `media_type` is e.g. "audio/mp3". `opts_json` is optional JSON options.
|
|
102
|
-
*
|
|
127
|
+
* `bridge` — optional `AbortBridge`; aborting the wrapped signal cancels
|
|
128
|
+
* the call. Returns JSON-serialized TranscriptionResult.
|
|
103
129
|
*/
|
|
104
|
-
generate(audioBase64: string, mediaType: string, optsJson?: string | undefined | null): Promise<string>
|
|
130
|
+
generate(audioBase64: string, mediaType: string, optsJson?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
105
131
|
}
|
|
106
132
|
|
|
107
133
|
export declare class VideoModel {
|
|
108
134
|
/**
|
|
109
135
|
* Generate video. `opts_json` is JSON-serialized VideoCallOptions.
|
|
110
|
-
*
|
|
136
|
+
* `bridge` — optional `AbortBridge`; aborting the wrapped signal cancels
|
|
137
|
+
* the call. Returns JSON-serialized VideoResult (typically contains a URL).
|
|
111
138
|
*/
|
|
112
|
-
generate(optsJson: string): Promise<string>
|
|
139
|
+
generate(optsJson: string, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
113
140
|
}
|
|
114
141
|
|
|
115
142
|
/** Create an Anthropic model instance. */
|
|
116
143
|
export declare function anthropic(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
117
144
|
|
|
145
|
+
/** Create an Anthropic-on-AWS language model instance (API key + region). */
|
|
146
|
+
export declare function anthropicAws(apiKey: string, region: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Create an Azure OpenAI language model instance (API key + resource name).
|
|
150
|
+
*
|
|
151
|
+
* The deployment name is passed as `model_id`; `api_version` is optional.
|
|
152
|
+
*/
|
|
153
|
+
export declare function azure(apiKey: string, resourceName: string, deployment: string, apiVersion?: string | undefined | null, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
154
|
+
|
|
155
|
+
/** Create a Bedrock language model instance (AWS SigV4 credentials). */
|
|
156
|
+
export declare function bedrock(accessKeyId: string, secretAccessKey: string, region: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
157
|
+
|
|
158
|
+
/** Create a Cohere language model instance. */
|
|
159
|
+
export declare function cohere(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
160
|
+
|
|
118
161
|
/** Create a Cohere embedding model instance. */
|
|
119
162
|
export declare function cohereEmbedding(apiKey: string, modelId: string, baseUrl?: string | undefined | null): Promise<EmbeddingModel>
|
|
120
163
|
|
|
121
164
|
/** Create a Cohere reranking model instance. */
|
|
122
165
|
export declare function cohereReranking(apiKey: string, modelId: string, baseUrl?: string | undefined | null): Promise<RerankingModel>
|
|
123
166
|
|
|
124
|
-
/** Create a DeepSeek model instance. */
|
|
167
|
+
/** Create a DeepSeek model instance (registry-backed since RFC-0017 phase 4). */
|
|
125
168
|
export declare function deepseek(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
126
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Create a Google Gemini language model instance.
|
|
172
|
+
*
|
|
173
|
+
* Google speaks the native `generateContent` protocol (not OpenAI-compatible),
|
|
174
|
+
* so it is **not** registry-backed — `provider("google", ...)` fails with
|
|
175
|
+
* `UnknownProvider`. This factory is the only entry point.
|
|
176
|
+
*/
|
|
177
|
+
export declare function google(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
178
|
+
|
|
127
179
|
/** Create a Google embedding model instance. */
|
|
128
180
|
export declare function googleEmbedding(apiKey: string, modelId: string, baseUrl?: string | undefined | null): Promise<EmbeddingModel>
|
|
129
181
|
|
|
@@ -133,6 +185,17 @@ export declare function googleImage(apiKey: string, modelId: string, baseUrl?: s
|
|
|
133
185
|
/** Create a Google video model instance. */
|
|
134
186
|
export declare function googleVideo(apiKey: string, modelId: string, baseUrl?: string | undefined | null): Promise<VideoModel>
|
|
135
187
|
|
|
188
|
+
/**
|
|
189
|
+
* 初始化全局日志(RFC-0014)。幂等:多次调用无副作用;宿主已自建
|
|
190
|
+
* subscriber 时 no-op。级别:off|error|warn|info|debug|trace(空串回退
|
|
191
|
+
* warn)。`AIMUX_LOG` / `AIMUX_LOG_LEVEL` 环境变量优先级更高。
|
|
192
|
+
* 日志输出到 stderr。
|
|
193
|
+
*/
|
|
194
|
+
export declare function initLogging(level: string): void
|
|
195
|
+
|
|
196
|
+
/** Create a Mistral language model instance. */
|
|
197
|
+
export declare function mistral(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
198
|
+
|
|
136
199
|
/** Create an OpenAI model instance. */
|
|
137
200
|
export declare function openai(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
138
201
|
|
|
@@ -151,6 +214,13 @@ export declare function openaiSpeech(apiKey: string, modelId: string, baseUrl?:
|
|
|
151
214
|
/** Create an OpenAI transcription model instance. */
|
|
152
215
|
export declare function openaiTranscription(apiKey: string, modelId: string, baseUrl?: string | undefined | null): Promise<TranscriptionModel>
|
|
153
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Create a language model from the built-in registry by provider name
|
|
219
|
+
* (RFC-0017 phase 4). `api_key` may be empty/null to read the provider's env
|
|
220
|
+
* var from the registry entry.
|
|
221
|
+
*/
|
|
222
|
+
export declare function provider(name: string, apiKey: string | undefined | null, modelId: string, config?: ProviderConfig | undefined | null): Promise<Model>
|
|
223
|
+
|
|
154
224
|
/**
|
|
155
225
|
* Optional provider configuration accepted by factory functions.
|
|
156
226
|
*
|
|
@@ -183,3 +253,9 @@ export interface ProviderConfig {
|
|
|
183
253
|
|
|
184
254
|
/** Create a Tavily search model instance. */
|
|
185
255
|
export declare function tavilySearch(apiKey: string, baseUrl?: string | undefined | null): Promise<SearchModel>
|
|
256
|
+
|
|
257
|
+
/** Create a Vertex AI language model instance (GCP bearer token). */
|
|
258
|
+
export declare function vertex(accessToken: string, project: string, location: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
259
|
+
|
|
260
|
+
/** Create an xAI language model instance. */
|
|
261
|
+
export declare function xai(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|