@arcships/aimux 0.1.3 → 0.2.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/dist/index.d.ts +6 -3
- package/dist/index.js +26 -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 +257 -0
- package/dist/types/ProviderName.js +261 -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 +46 -8
- package/index.js +2 -0
- package/package.json +23 -19
- package/aimux.darwin-arm64.node +0 -0
- package/aimux.linux-x64-gnu.node +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Model } from '../index.js';
|
|
2
2
|
import type { GenerateTextOptions, GenerateTextResult, StreamPart, ModelMessage, Tool, ToolChoice, ToolCall, ToolResult, Usage, FinishReason, Warning, Role, MessageContent, ContentPart, ResponseFormat, ReasoningEffort, AiMuxError, GenerateResult, FunctionTool } from './types';
|
|
3
|
-
export { Model, StreamTextGenerator, openai, anthropic, deepseek } from '../index.js';
|
|
3
|
+
export { Model, StreamTextGenerator, AbortBridge, openai, anthropic, deepseek, google, cohere, mistral, xai, bedrock, vertex, anthropicAws, azure, provider, } from '../index.js';
|
|
4
|
+
export type { ProviderName } from './types/ProviderName';
|
|
4
5
|
export type { GenerateTextOptions, GenerateTextResult, StreamPart, ModelMessage, Tool, ToolChoice, ToolCall, ToolResult, Usage, FinishReason, Warning, Role, MessageContent, ContentPart, ResponseFormat, ReasoningEffort, AiMuxError, GenerateResult, FunctionTool, };
|
|
5
6
|
/**
|
|
6
7
|
* A raw napi `Model` instance returned by `openai()` / `anthropic()` / …
|
|
@@ -17,6 +18,7 @@ export type RawModel = Model;
|
|
|
17
18
|
* @param prompt - A plain string or an array of typed chat messages.
|
|
18
19
|
* @param options - Optional typed generation options (tools, tool_choice,
|
|
19
20
|
* temperature, response_format, …).
|
|
21
|
+
* @param signal - Optional `AbortSignal`; aborting it cancels the call.
|
|
20
22
|
*
|
|
21
23
|
* Internally calls the raw
|
|
22
24
|
* `model.generateText(JSON.stringify(prompt), options ? JSON.stringify(options) : undefined)`
|
|
@@ -30,13 +32,14 @@ export type RawModel = Model;
|
|
|
30
32
|
* console.log(result.text, result.usage)
|
|
31
33
|
* ```
|
|
32
34
|
*/
|
|
33
|
-
export declare function generateText(model: RawModel, prompt: string | ModelMessage[], options?: GenerateTextOptions): Promise<GenerateTextResult>;
|
|
35
|
+
export declare function generateText(model: RawModel, prompt: string | ModelMessage[], options?: GenerateTextOptions, signal?: AbortSignal): Promise<GenerateTextResult>;
|
|
34
36
|
/**
|
|
35
37
|
* Stream text from a model. Yields typed {@link StreamPart}s.
|
|
36
38
|
*
|
|
37
39
|
* @param model - A raw model instance from `openai()`, `anthropic()`, etc.
|
|
38
40
|
* @param prompt - A plain string or an array of typed chat messages.
|
|
39
41
|
* @param options - Optional typed generation options (tools, tool_choice, …).
|
|
42
|
+
* @param signal - Optional `AbortSignal`; aborting it cancels the stream.
|
|
40
43
|
*
|
|
41
44
|
* Internally drives the raw `model.streamText(JSON.stringify(prompt), …)`
|
|
42
45
|
* async generator and `JSON.parse`s each JSON-string chunk before yielding it
|
|
@@ -51,4 +54,4 @@ export declare function generateText(model: RawModel, prompt: string | ModelMess
|
|
|
51
54
|
* }
|
|
52
55
|
* ```
|
|
53
56
|
*/
|
|
54
|
-
export declare function streamText(model: RawModel, prompt: string | ModelMessage[], options?: GenerateTextOptions): AsyncGenerator<StreamPart>;
|
|
57
|
+
export declare function streamText(model: RawModel, prompt: string | ModelMessage[], options?: GenerateTextOptions, signal?: AbortSignal): AsyncGenerator<StreamPart>;
|
package/dist/index.js
CHANGED
|
@@ -13,17 +13,28 @@
|
|
|
13
13
|
// The raw napi API (`index.js` / `index.d.ts`, auto-generated) is untouched.
|
|
14
14
|
// This is purely an extra TypeScript layer on top.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.deepseek = exports.anthropic = exports.openai = exports.StreamTextGenerator = exports.Model = void 0;
|
|
16
|
+
exports.provider = exports.azure = exports.anthropicAws = exports.vertex = exports.bedrock = exports.xai = exports.mistral = exports.cohere = exports.google = exports.deepseek = exports.anthropic = exports.openai = exports.AbortBridge = exports.StreamTextGenerator = exports.Model = void 0;
|
|
17
17
|
exports.generateText = generateText;
|
|
18
18
|
exports.streamText = streamText;
|
|
19
|
+
const index_js_1 = require("../index.js");
|
|
19
20
|
// Re-export the raw napi constructors/factories so consumers can do everything
|
|
20
21
|
// from a single import: `import { openai, generateText } from 'aimux'`.
|
|
21
|
-
var
|
|
22
|
-
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return
|
|
23
|
-
Object.defineProperty(exports, "StreamTextGenerator", { enumerable: true, get: function () { return
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
Object.defineProperty(exports, "
|
|
22
|
+
var index_js_2 = require("../index.js");
|
|
23
|
+
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return index_js_2.Model; } });
|
|
24
|
+
Object.defineProperty(exports, "StreamTextGenerator", { enumerable: true, get: function () { return index_js_2.StreamTextGenerator; } });
|
|
25
|
+
Object.defineProperty(exports, "AbortBridge", { enumerable: true, get: function () { return index_js_2.AbortBridge; } });
|
|
26
|
+
Object.defineProperty(exports, "openai", { enumerable: true, get: function () { return index_js_2.openai; } });
|
|
27
|
+
Object.defineProperty(exports, "anthropic", { enumerable: true, get: function () { return index_js_2.anthropic; } });
|
|
28
|
+
Object.defineProperty(exports, "deepseek", { enumerable: true, get: function () { return index_js_2.deepseek; } });
|
|
29
|
+
Object.defineProperty(exports, "google", { enumerable: true, get: function () { return index_js_2.google; } });
|
|
30
|
+
Object.defineProperty(exports, "cohere", { enumerable: true, get: function () { return index_js_2.cohere; } });
|
|
31
|
+
Object.defineProperty(exports, "mistral", { enumerable: true, get: function () { return index_js_2.mistral; } });
|
|
32
|
+
Object.defineProperty(exports, "xai", { enumerable: true, get: function () { return index_js_2.xai; } });
|
|
33
|
+
Object.defineProperty(exports, "bedrock", { enumerable: true, get: function () { return index_js_2.bedrock; } });
|
|
34
|
+
Object.defineProperty(exports, "vertex", { enumerable: true, get: function () { return index_js_2.vertex; } });
|
|
35
|
+
Object.defineProperty(exports, "anthropicAws", { enumerable: true, get: function () { return index_js_2.anthropicAws; } });
|
|
36
|
+
Object.defineProperty(exports, "azure", { enumerable: true, get: function () { return index_js_2.azure; } });
|
|
37
|
+
Object.defineProperty(exports, "provider", { enumerable: true, get: function () { return index_js_2.provider; } });
|
|
27
38
|
/**
|
|
28
39
|
* Generate text (non-streaming). Returns a typed {@link GenerateTextResult}.
|
|
29
40
|
*
|
|
@@ -31,6 +42,7 @@ Object.defineProperty(exports, "deepseek", { enumerable: true, get: function ()
|
|
|
31
42
|
* @param prompt - A plain string or an array of typed chat messages.
|
|
32
43
|
* @param options - Optional typed generation options (tools, tool_choice,
|
|
33
44
|
* temperature, response_format, …).
|
|
45
|
+
* @param signal - Optional `AbortSignal`; aborting it cancels the call.
|
|
34
46
|
*
|
|
35
47
|
* Internally calls the raw
|
|
36
48
|
* `model.generateText(JSON.stringify(prompt), options ? JSON.stringify(options) : undefined)`
|
|
@@ -44,9 +56,10 @@ Object.defineProperty(exports, "deepseek", { enumerable: true, get: function ()
|
|
|
44
56
|
* console.log(result.text, result.usage)
|
|
45
57
|
* ```
|
|
46
58
|
*/
|
|
47
|
-
async function generateText(model, prompt, options) {
|
|
59
|
+
async function generateText(model, prompt, options, signal) {
|
|
48
60
|
const optsJson = options ? JSON.stringify(options) : undefined;
|
|
49
|
-
const
|
|
61
|
+
const bridge = signal ? new index_js_1.AbortBridge(signal) : undefined;
|
|
62
|
+
const resultJson = await model.generateText(JSON.stringify(prompt), optsJson, bridge);
|
|
50
63
|
return JSON.parse(resultJson);
|
|
51
64
|
}
|
|
52
65
|
/**
|
|
@@ -55,6 +68,7 @@ async function generateText(model, prompt, options) {
|
|
|
55
68
|
* @param model - A raw model instance from `openai()`, `anthropic()`, etc.
|
|
56
69
|
* @param prompt - A plain string or an array of typed chat messages.
|
|
57
70
|
* @param options - Optional typed generation options (tools, tool_choice, …).
|
|
71
|
+
* @param signal - Optional `AbortSignal`; aborting it cancels the stream.
|
|
58
72
|
*
|
|
59
73
|
* Internally drives the raw `model.streamText(JSON.stringify(prompt), …)`
|
|
60
74
|
* async generator and `JSON.parse`s each JSON-string chunk before yielding it
|
|
@@ -69,9 +83,10 @@ async function generateText(model, prompt, options) {
|
|
|
69
83
|
* }
|
|
70
84
|
* ```
|
|
71
85
|
*/
|
|
72
|
-
async function* streamText(model, prompt, options) {
|
|
86
|
+
async function* streamText(model, prompt, options, signal) {
|
|
73
87
|
const optsJson = options ? JSON.stringify(options) : undefined;
|
|
74
|
-
const
|
|
88
|
+
const bridge = signal ? new index_js_1.AbortBridge(signal) : undefined;
|
|
89
|
+
const gen = await model.streamText(JSON.stringify(prompt), optsJson, bridge);
|
|
75
90
|
for await (const json of gen) {
|
|
76
91
|
yield JSON.parse(json);
|
|
77
92
|
}
|
|
@@ -57,6 +57,12 @@ export type ContentPart = {
|
|
|
57
57
|
* Arguments as a JSON value (usually an object).
|
|
58
58
|
*/
|
|
59
59
|
input: JsonValue;
|
|
60
|
+
/**
|
|
61
|
+
* Provider-assigned thought signature (e.g. Google Gemini
|
|
62
|
+
* `thoughtSignature`). Must be echoed back verbatim on the follow-up
|
|
63
|
+
* turn when the tool result is sent.
|
|
64
|
+
*/
|
|
65
|
+
thought_signature?: string | null;
|
|
60
66
|
/**
|
|
61
67
|
* Provider-specific options for this part (e.g.
|
|
62
68
|
* `anthropic.cacheControl`).
|
|
@@ -22,6 +22,12 @@ export type GenerateContent = {
|
|
|
22
22
|
* Whether the tool is dynamic (defined at runtime, e.g. MCP tools).
|
|
23
23
|
*/
|
|
24
24
|
dynamic?: boolean | null;
|
|
25
|
+
/**
|
|
26
|
+
* Provider-assigned thought signature (e.g. Google Gemini
|
|
27
|
+
* `thoughtSignature`). Must be echoed back verbatim on the follow-up
|
|
28
|
+
* turn when the tool result is sent.
|
|
29
|
+
*/
|
|
30
|
+
thought_signature?: string | null;
|
|
25
31
|
/**
|
|
26
32
|
* Additional provider-specific metadata for the tool call.
|
|
27
33
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReasoningEffort } from "./ReasoningEffort";
|
|
2
2
|
import type { ResponseFormat } from "./ResponseFormat";
|
|
3
|
+
import type { TimeoutConfiguration } from "./TimeoutConfiguration";
|
|
3
4
|
import type { Tool } from "./Tool";
|
|
4
5
|
import type { ToolChoice } from "./ToolChoice";
|
|
5
6
|
import type { JsonValue } from "./serde_json/JsonValue";
|
|
@@ -43,4 +44,8 @@ export type GenerateTextOptions = {
|
|
|
43
44
|
* Per-call retry count override. `None` = provider default, `Some(0)` = disable.
|
|
44
45
|
*/
|
|
45
46
|
max_retries: number | null;
|
|
47
|
+
/**
|
|
48
|
+
* Per-call timeout configuration (total / first-chunk / chunk idle).
|
|
49
|
+
*/
|
|
50
|
+
timeout: TimeoutConfiguration | null;
|
|
46
51
|
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names of all built-in OpenAI-compatible providers.
|
|
3
|
+
* Use `ProviderName.groq` etc. as the `name` argument of `provider()`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ProviderName: {
|
|
6
|
+
readonly abacus: "abacus";
|
|
7
|
+
readonly abliteration_ai: "abliteration_ai";
|
|
8
|
+
readonly ai21: "ai21";
|
|
9
|
+
readonly ai302: "ai302";
|
|
10
|
+
readonly ai_router: "ai_router";
|
|
11
|
+
readonly aiand: "aiand";
|
|
12
|
+
readonly aibadgr: "aibadgr";
|
|
13
|
+
readonly aigc2d: "aigc2d";
|
|
14
|
+
readonly aihubmix: "aihubmix";
|
|
15
|
+
readonly ails: "ails";
|
|
16
|
+
readonly aiml: "aiml";
|
|
17
|
+
readonly aki_io: "aki_io";
|
|
18
|
+
readonly albert: "albert";
|
|
19
|
+
readonly alibaba: "alibaba";
|
|
20
|
+
readonly alibaba_coding_plan: "alibaba_coding_plan";
|
|
21
|
+
readonly alibaba_coding_plan_cn: "alibaba_coding_plan_cn";
|
|
22
|
+
readonly alibaba_token_plan: "alibaba_token_plan";
|
|
23
|
+
readonly alibaba_token_plan_cn: "alibaba_token_plan_cn";
|
|
24
|
+
readonly ambient: "ambient";
|
|
25
|
+
readonly anyapi: "anyapi";
|
|
26
|
+
readonly anyscale: "anyscale";
|
|
27
|
+
readonly apertis: "apertis";
|
|
28
|
+
readonly api2d: "api2d";
|
|
29
|
+
readonly api2gpt: "api2gpt";
|
|
30
|
+
readonly apiserpent: "apiserpent";
|
|
31
|
+
readonly atlascloud: "atlascloud";
|
|
32
|
+
readonly atomic_chat: "atomic_chat";
|
|
33
|
+
readonly auriko: "auriko";
|
|
34
|
+
readonly azure_ai: "azure_ai";
|
|
35
|
+
readonly baichuan: "baichuan";
|
|
36
|
+
readonly baidu: "baidu";
|
|
37
|
+
readonly baidu_v2: "baidu_v2";
|
|
38
|
+
readonly bailing: "bailing";
|
|
39
|
+
readonly baseten: "baseten";
|
|
40
|
+
readonly berget: "berget";
|
|
41
|
+
readonly bigmodel: "bigmodel";
|
|
42
|
+
readonly blueclaw: "blueclaw";
|
|
43
|
+
readonly bytedance: "bytedance";
|
|
44
|
+
readonly byteplus: "byteplus";
|
|
45
|
+
readonly bytez: "bytez";
|
|
46
|
+
readonly canopywave: "canopywave";
|
|
47
|
+
readonly cerebras: "cerebras";
|
|
48
|
+
readonly chatgpt: "chatgpt";
|
|
49
|
+
readonly cherryin: "cherryin";
|
|
50
|
+
readonly chutes: "chutes";
|
|
51
|
+
readonly clarifai: "clarifai";
|
|
52
|
+
readonly claudinio: "claudinio";
|
|
53
|
+
readonly cline_pass: "cline_pass";
|
|
54
|
+
readonly closeai: "closeai";
|
|
55
|
+
readonly cloudferro_sherlock: "cloudferro_sherlock";
|
|
56
|
+
readonly cloudflare: "cloudflare";
|
|
57
|
+
readonly cloudflare_workers_ai: "cloudflare_workers_ai";
|
|
58
|
+
readonly codestral: "codestral";
|
|
59
|
+
readonly cometapi: "cometapi";
|
|
60
|
+
readonly commandcode: "commandcode";
|
|
61
|
+
readonly compactifai: "compactifai";
|
|
62
|
+
readonly copilot: "copilot";
|
|
63
|
+
readonly cortecs: "cortecs";
|
|
64
|
+
readonly coze: "coze";
|
|
65
|
+
readonly crof: "crof";
|
|
66
|
+
readonly crossmodel: "crossmodel";
|
|
67
|
+
readonly crusoe: "crusoe";
|
|
68
|
+
readonly daoxe: "daoxe";
|
|
69
|
+
readonly darkbloom: "darkbloom";
|
|
70
|
+
readonly databricks: "databricks";
|
|
71
|
+
readonly datarobot: "datarobot";
|
|
72
|
+
readonly deepbricks: "deepbricks";
|
|
73
|
+
readonly deepinfra: "deepinfra";
|
|
74
|
+
readonly deepseek: "deepseek";
|
|
75
|
+
readonly digitalocean: "digitalocean";
|
|
76
|
+
readonly dinference: "dinference";
|
|
77
|
+
readonly doubao: "doubao";
|
|
78
|
+
readonly doubleword: "doubleword";
|
|
79
|
+
readonly drun: "drun";
|
|
80
|
+
readonly ebcloud: "ebcloud";
|
|
81
|
+
readonly embercloud: "embercloud";
|
|
82
|
+
readonly empiriolabs: "empiriolabs";
|
|
83
|
+
readonly evroc: "evroc";
|
|
84
|
+
readonly fastcrw: "fastcrw";
|
|
85
|
+
readonly fastgpt: "fastgpt";
|
|
86
|
+
readonly fastrouter: "fastrouter";
|
|
87
|
+
readonly featherless_ai: "featherless_ai";
|
|
88
|
+
readonly firepass: "firepass";
|
|
89
|
+
readonly fireworks: "fireworks";
|
|
90
|
+
readonly freemodel: "freemodel";
|
|
91
|
+
readonly friendliai: "friendliai";
|
|
92
|
+
readonly frogbot: "frogbot";
|
|
93
|
+
readonly galadriel: "galadriel";
|
|
94
|
+
readonly gdc: "gdc";
|
|
95
|
+
readonly gigachat: "gigachat";
|
|
96
|
+
readonly github: "github";
|
|
97
|
+
readonly gmi: "gmi";
|
|
98
|
+
readonly gmicloud: "gmicloud";
|
|
99
|
+
readonly gonka24: "gonka24";
|
|
100
|
+
readonly gradient_ai: "gradient_ai";
|
|
101
|
+
readonly groq: "groq";
|
|
102
|
+
readonly helicone: "helicone";
|
|
103
|
+
readonly heroku: "heroku";
|
|
104
|
+
readonly hetzner: "hetzner";
|
|
105
|
+
readonly hosted_vllm: "hosted_vllm";
|
|
106
|
+
readonly hpc_ai: "hpc_ai";
|
|
107
|
+
readonly hyperbolic: "hyperbolic";
|
|
108
|
+
readonly iflowcn: "iflowcn";
|
|
109
|
+
readonly inception: "inception";
|
|
110
|
+
readonly inceptron: "inceptron";
|
|
111
|
+
readonly inference_net: "inference_net";
|
|
112
|
+
readonly inferx: "inferx";
|
|
113
|
+
readonly infinity: "infinity";
|
|
114
|
+
readonly io_net: "io_net";
|
|
115
|
+
readonly jiekou: "jiekou";
|
|
116
|
+
readonly kenari: "kenari";
|
|
117
|
+
readonly kilo: "kilo";
|
|
118
|
+
readonly kimi: "kimi";
|
|
119
|
+
readonly kimi_for_coding: "kimi_for_coding";
|
|
120
|
+
readonly kiro: "kiro";
|
|
121
|
+
readonly kluster_ai: "kluster_ai";
|
|
122
|
+
readonly krutrim: "krutrim";
|
|
123
|
+
readonly kuae_cloud_coding_plan: "kuae_cloud_coding_plan";
|
|
124
|
+
readonly lambda_ai: "lambda_ai";
|
|
125
|
+
readonly lemonade: "lemonade";
|
|
126
|
+
readonly lemonfox_ai: "lemonfox_ai";
|
|
127
|
+
readonly libertai: "libertai";
|
|
128
|
+
readonly lilac: "lilac";
|
|
129
|
+
readonly lingyiwanwu: "lingyiwanwu";
|
|
130
|
+
readonly llama: "llama";
|
|
131
|
+
readonly llamagate: "llamagate";
|
|
132
|
+
readonly llmgateway: "llmgateway";
|
|
133
|
+
readonly llmtr: "llmtr";
|
|
134
|
+
readonly longcat: "longcat";
|
|
135
|
+
readonly lucidquery: "lucidquery";
|
|
136
|
+
readonly lynkr: "lynkr";
|
|
137
|
+
readonly matterai: "matterai";
|
|
138
|
+
readonly meganova: "meganova";
|
|
139
|
+
readonly merge_gateway: "merge_gateway";
|
|
140
|
+
readonly meta: "meta";
|
|
141
|
+
readonly meta_llama: "meta_llama";
|
|
142
|
+
readonly mimo: "mimo";
|
|
143
|
+
readonly minimax: "minimax";
|
|
144
|
+
readonly minimax_cn: "minimax_cn";
|
|
145
|
+
readonly minimax_cn_coding_plan: "minimax_cn_coding_plan";
|
|
146
|
+
readonly minimax_coding_plan: "minimax_coding_plan";
|
|
147
|
+
readonly mira: "mira";
|
|
148
|
+
readonly mixlayer: "mixlayer";
|
|
149
|
+
readonly moark: "moark";
|
|
150
|
+
readonly modal: "modal";
|
|
151
|
+
readonly model_oracle_ai: "model_oracle_ai";
|
|
152
|
+
readonly modelscope: "modelscope";
|
|
153
|
+
readonly moonshotai: "moonshotai";
|
|
154
|
+
readonly moonshotai_cn: "moonshotai_cn";
|
|
155
|
+
readonly morph: "morph";
|
|
156
|
+
readonly nanogpt: "nanogpt";
|
|
157
|
+
readonly ncompass: "ncompass";
|
|
158
|
+
readonly nearai: "nearai";
|
|
159
|
+
readonly nebius: "nebius";
|
|
160
|
+
readonly neon: "neon";
|
|
161
|
+
readonly neuralwatt: "neuralwatt";
|
|
162
|
+
readonly nextbit: "nextbit";
|
|
163
|
+
readonly nlp_cloud: "nlp_cloud";
|
|
164
|
+
readonly nous_research: "nous_research";
|
|
165
|
+
readonly novita: "novita";
|
|
166
|
+
readonly nscale: "nscale";
|
|
167
|
+
readonly nvidia_nim: "nvidia_nim";
|
|
168
|
+
readonly oci: "oci";
|
|
169
|
+
readonly ofox: "ofox";
|
|
170
|
+
readonly ohmygpt: "ohmygpt";
|
|
171
|
+
readonly ollama_cloud: "ollama_cloud";
|
|
172
|
+
readonly openaimax: "openaimax";
|
|
173
|
+
readonly openaisb: "openaisb";
|
|
174
|
+
readonly opencode: "opencode";
|
|
175
|
+
readonly opencode_go: "opencode_go";
|
|
176
|
+
readonly opencode_zen: "opencode_zen";
|
|
177
|
+
readonly orcarouter: "orcarouter";
|
|
178
|
+
readonly ovhcloud: "ovhcloud";
|
|
179
|
+
readonly parasail: "parasail";
|
|
180
|
+
readonly perfxcloud: "perfxcloud";
|
|
181
|
+
readonly perplexity: "perplexity";
|
|
182
|
+
readonly perplexity_agent: "perplexity_agent";
|
|
183
|
+
readonly petals: "petals";
|
|
184
|
+
readonly pinstripes: "pinstripes";
|
|
185
|
+
readonly pioneer: "pioneer";
|
|
186
|
+
readonly poe: "poe";
|
|
187
|
+
readonly poolside: "poolside";
|
|
188
|
+
readonly portkey: "portkey";
|
|
189
|
+
readonly ppinfra: "ppinfra";
|
|
190
|
+
readonly predibase: "predibase";
|
|
191
|
+
readonly privatemode_ai: "privatemode_ai";
|
|
192
|
+
readonly publicai: "publicai";
|
|
193
|
+
readonly qihang_ai: "qihang_ai";
|
|
194
|
+
readonly qihoo360: "qihoo360";
|
|
195
|
+
readonly qiniu_ai: "qiniu_ai";
|
|
196
|
+
readonly regolo_ai: "regolo_ai";
|
|
197
|
+
readonly reka_ai: "reka_ai";
|
|
198
|
+
readonly requesty: "requesty";
|
|
199
|
+
readonly reve: "reve";
|
|
200
|
+
readonly routing_run: "routing_run";
|
|
201
|
+
readonly sakana: "sakana";
|
|
202
|
+
readonly sambanova: "sambanova";
|
|
203
|
+
readonly sarvam: "sarvam";
|
|
204
|
+
readonly scaleway: "scaleway";
|
|
205
|
+
readonly scx_ai: "scx_ai";
|
|
206
|
+
readonly siliconflow: "siliconflow";
|
|
207
|
+
readonly snowflake: "snowflake";
|
|
208
|
+
readonly snowflake_cortex: "snowflake_cortex";
|
|
209
|
+
readonly stackit: "stackit";
|
|
210
|
+
readonly stepfun: "stepfun";
|
|
211
|
+
readonly stepfun_ai_step_plan: "stepfun_ai_step_plan";
|
|
212
|
+
readonly stepfun_step_plan: "stepfun_step_plan";
|
|
213
|
+
readonly subconscious: "subconscious";
|
|
214
|
+
readonly submodel: "submodel";
|
|
215
|
+
readonly synthetic: "synthetic";
|
|
216
|
+
readonly tencent: "tencent";
|
|
217
|
+
readonly tencent_coding_plan: "tencent_coding_plan";
|
|
218
|
+
readonly tencent_token_plan: "tencent_token_plan";
|
|
219
|
+
readonly tencent_token_plan_enterprise_auto: "tencent_token_plan_enterprise_auto";
|
|
220
|
+
readonly tencent_token_plan_enterprise_pro: "tencent_token_plan_enterprise_pro";
|
|
221
|
+
readonly tencent_token_plan_general_personal: "tencent_token_plan_general_personal";
|
|
222
|
+
readonly tencent_token_plan_hy_personal: "tencent_token_plan_hy_personal";
|
|
223
|
+
readonly tencent_tokenhub: "tencent_tokenhub";
|
|
224
|
+
readonly tensormesh: "tensormesh";
|
|
225
|
+
readonly the_grid_ai: "the_grid_ai";
|
|
226
|
+
readonly thinkingmachines: "thinkingmachines";
|
|
227
|
+
readonly tinfoil: "tinfoil";
|
|
228
|
+
readonly togetherai: "togetherai";
|
|
229
|
+
readonly tokenflux: "tokenflux";
|
|
230
|
+
readonly tokenpony: "tokenpony";
|
|
231
|
+
readonly trustedrouter: "trustedrouter";
|
|
232
|
+
readonly tundra: "tundra";
|
|
233
|
+
readonly umans_ai: "umans_ai";
|
|
234
|
+
readonly unorouter: "unorouter";
|
|
235
|
+
readonly upstage: "upstage";
|
|
236
|
+
readonly v0: "v0";
|
|
237
|
+
readonly venice: "venice";
|
|
238
|
+
readonly vercel: "vercel";
|
|
239
|
+
readonly vivgrid: "vivgrid";
|
|
240
|
+
readonly volc_engine: "volc_engine";
|
|
241
|
+
readonly vultr: "vultr";
|
|
242
|
+
readonly wafer: "wafer";
|
|
243
|
+
readonly wandb: "wandb";
|
|
244
|
+
readonly xiaomi_token_plan_ams: "xiaomi_token_plan_ams";
|
|
245
|
+
readonly xiaomi_token_plan_cn: "xiaomi_token_plan_cn";
|
|
246
|
+
readonly xiaomi_token_plan_sgp: "xiaomi_token_plan_sgp";
|
|
247
|
+
readonly xiaomimimo: "xiaomimimo";
|
|
248
|
+
readonly xpersona: "xpersona";
|
|
249
|
+
readonly xunfei: "xunfei";
|
|
250
|
+
readonly zai: "zai";
|
|
251
|
+
readonly zai_coding_plan: "zai_coding_plan";
|
|
252
|
+
readonly zeldoc: "zeldoc";
|
|
253
|
+
readonly zenmux: "zenmux";
|
|
254
|
+
readonly zhipu_v4: "zhipu_v4";
|
|
255
|
+
readonly zhipuai_coding_plan: "zhipuai_coding_plan";
|
|
256
|
+
};
|
|
257
|
+
export type ProviderName = typeof ProviderName[keyof typeof ProviderName];
|
|
@@ -0,0 +1,261 @@
|
|
|
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
|
+
inferx: 'inferx',
|
|
118
|
+
infinity: 'infinity',
|
|
119
|
+
io_net: 'io_net',
|
|
120
|
+
jiekou: 'jiekou',
|
|
121
|
+
kenari: 'kenari',
|
|
122
|
+
kilo: 'kilo',
|
|
123
|
+
kimi: 'kimi',
|
|
124
|
+
kimi_for_coding: 'kimi_for_coding',
|
|
125
|
+
kiro: 'kiro',
|
|
126
|
+
kluster_ai: 'kluster_ai',
|
|
127
|
+
krutrim: 'krutrim',
|
|
128
|
+
kuae_cloud_coding_plan: 'kuae_cloud_coding_plan',
|
|
129
|
+
lambda_ai: 'lambda_ai',
|
|
130
|
+
lemonade: 'lemonade',
|
|
131
|
+
lemonfox_ai: 'lemonfox_ai',
|
|
132
|
+
libertai: 'libertai',
|
|
133
|
+
lilac: 'lilac',
|
|
134
|
+
lingyiwanwu: 'lingyiwanwu',
|
|
135
|
+
llama: 'llama',
|
|
136
|
+
llamagate: 'llamagate',
|
|
137
|
+
llmgateway: 'llmgateway',
|
|
138
|
+
llmtr: 'llmtr',
|
|
139
|
+
longcat: 'longcat',
|
|
140
|
+
lucidquery: 'lucidquery',
|
|
141
|
+
lynkr: 'lynkr',
|
|
142
|
+
matterai: 'matterai',
|
|
143
|
+
meganova: 'meganova',
|
|
144
|
+
merge_gateway: 'merge_gateway',
|
|
145
|
+
meta: 'meta',
|
|
146
|
+
meta_llama: 'meta_llama',
|
|
147
|
+
mimo: 'mimo',
|
|
148
|
+
minimax: 'minimax',
|
|
149
|
+
minimax_cn: 'minimax_cn',
|
|
150
|
+
minimax_cn_coding_plan: 'minimax_cn_coding_plan',
|
|
151
|
+
minimax_coding_plan: 'minimax_coding_plan',
|
|
152
|
+
mira: 'mira',
|
|
153
|
+
mixlayer: 'mixlayer',
|
|
154
|
+
moark: 'moark',
|
|
155
|
+
modal: 'modal',
|
|
156
|
+
model_oracle_ai: 'model_oracle_ai',
|
|
157
|
+
modelscope: 'modelscope',
|
|
158
|
+
moonshotai: 'moonshotai',
|
|
159
|
+
moonshotai_cn: 'moonshotai_cn',
|
|
160
|
+
morph: 'morph',
|
|
161
|
+
nanogpt: 'nanogpt',
|
|
162
|
+
ncompass: 'ncompass',
|
|
163
|
+
nearai: 'nearai',
|
|
164
|
+
nebius: 'nebius',
|
|
165
|
+
neon: 'neon',
|
|
166
|
+
neuralwatt: 'neuralwatt',
|
|
167
|
+
nextbit: 'nextbit',
|
|
168
|
+
nlp_cloud: 'nlp_cloud',
|
|
169
|
+
nous_research: 'nous_research',
|
|
170
|
+
novita: 'novita',
|
|
171
|
+
nscale: 'nscale',
|
|
172
|
+
nvidia_nim: 'nvidia_nim',
|
|
173
|
+
oci: 'oci',
|
|
174
|
+
ofox: 'ofox',
|
|
175
|
+
ohmygpt: 'ohmygpt',
|
|
176
|
+
ollama_cloud: 'ollama_cloud',
|
|
177
|
+
openaimax: 'openaimax',
|
|
178
|
+
openaisb: 'openaisb',
|
|
179
|
+
opencode: 'opencode',
|
|
180
|
+
opencode_go: 'opencode_go',
|
|
181
|
+
opencode_zen: 'opencode_zen',
|
|
182
|
+
orcarouter: 'orcarouter',
|
|
183
|
+
ovhcloud: 'ovhcloud',
|
|
184
|
+
parasail: 'parasail',
|
|
185
|
+
perfxcloud: 'perfxcloud',
|
|
186
|
+
perplexity: 'perplexity',
|
|
187
|
+
perplexity_agent: 'perplexity_agent',
|
|
188
|
+
petals: 'petals',
|
|
189
|
+
pinstripes: 'pinstripes',
|
|
190
|
+
pioneer: 'pioneer',
|
|
191
|
+
poe: 'poe',
|
|
192
|
+
poolside: 'poolside',
|
|
193
|
+
portkey: 'portkey',
|
|
194
|
+
ppinfra: 'ppinfra',
|
|
195
|
+
predibase: 'predibase',
|
|
196
|
+
privatemode_ai: 'privatemode_ai',
|
|
197
|
+
publicai: 'publicai',
|
|
198
|
+
qihang_ai: 'qihang_ai',
|
|
199
|
+
qihoo360: 'qihoo360',
|
|
200
|
+
qiniu_ai: 'qiniu_ai',
|
|
201
|
+
regolo_ai: 'regolo_ai',
|
|
202
|
+
reka_ai: 'reka_ai',
|
|
203
|
+
requesty: 'requesty',
|
|
204
|
+
reve: 'reve',
|
|
205
|
+
routing_run: 'routing_run',
|
|
206
|
+
sakana: 'sakana',
|
|
207
|
+
sambanova: 'sambanova',
|
|
208
|
+
sarvam: 'sarvam',
|
|
209
|
+
scaleway: 'scaleway',
|
|
210
|
+
scx_ai: 'scx_ai',
|
|
211
|
+
siliconflow: 'siliconflow',
|
|
212
|
+
snowflake: 'snowflake',
|
|
213
|
+
snowflake_cortex: 'snowflake_cortex',
|
|
214
|
+
stackit: 'stackit',
|
|
215
|
+
stepfun: 'stepfun',
|
|
216
|
+
stepfun_ai_step_plan: 'stepfun_ai_step_plan',
|
|
217
|
+
stepfun_step_plan: 'stepfun_step_plan',
|
|
218
|
+
subconscious: 'subconscious',
|
|
219
|
+
submodel: 'submodel',
|
|
220
|
+
synthetic: 'synthetic',
|
|
221
|
+
tencent: 'tencent',
|
|
222
|
+
tencent_coding_plan: 'tencent_coding_plan',
|
|
223
|
+
tencent_token_plan: 'tencent_token_plan',
|
|
224
|
+
tencent_token_plan_enterprise_auto: 'tencent_token_plan_enterprise_auto',
|
|
225
|
+
tencent_token_plan_enterprise_pro: 'tencent_token_plan_enterprise_pro',
|
|
226
|
+
tencent_token_plan_general_personal: 'tencent_token_plan_general_personal',
|
|
227
|
+
tencent_token_plan_hy_personal: 'tencent_token_plan_hy_personal',
|
|
228
|
+
tencent_tokenhub: 'tencent_tokenhub',
|
|
229
|
+
tensormesh: 'tensormesh',
|
|
230
|
+
the_grid_ai: 'the_grid_ai',
|
|
231
|
+
thinkingmachines: 'thinkingmachines',
|
|
232
|
+
tinfoil: 'tinfoil',
|
|
233
|
+
togetherai: 'togetherai',
|
|
234
|
+
tokenflux: 'tokenflux',
|
|
235
|
+
tokenpony: 'tokenpony',
|
|
236
|
+
trustedrouter: 'trustedrouter',
|
|
237
|
+
tundra: 'tundra',
|
|
238
|
+
umans_ai: 'umans_ai',
|
|
239
|
+
unorouter: 'unorouter',
|
|
240
|
+
upstage: 'upstage',
|
|
241
|
+
v0: 'v0',
|
|
242
|
+
venice: 'venice',
|
|
243
|
+
vercel: 'vercel',
|
|
244
|
+
vivgrid: 'vivgrid',
|
|
245
|
+
volc_engine: 'volc_engine',
|
|
246
|
+
vultr: 'vultr',
|
|
247
|
+
wafer: 'wafer',
|
|
248
|
+
wandb: 'wandb',
|
|
249
|
+
xiaomi_token_plan_ams: 'xiaomi_token_plan_ams',
|
|
250
|
+
xiaomi_token_plan_cn: 'xiaomi_token_plan_cn',
|
|
251
|
+
xiaomi_token_plan_sgp: 'xiaomi_token_plan_sgp',
|
|
252
|
+
xiaomimimo: 'xiaomimimo',
|
|
253
|
+
xpersona: 'xpersona',
|
|
254
|
+
xunfei: 'xunfei',
|
|
255
|
+
zai: 'zai',
|
|
256
|
+
zai_coding_plan: 'zai_coding_plan',
|
|
257
|
+
zeldoc: 'zeldoc',
|
|
258
|
+
zenmux: 'zenmux',
|
|
259
|
+
zhipu_v4: 'zhipu_v4',
|
|
260
|
+
zhipuai_coding_plan: 'zhipuai_coding_plan',
|
|
261
|
+
};
|
|
@@ -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
|
@@ -32,7 +32,17 @@ export declare class ImageModel {
|
|
|
32
32
|
* Generate images. `opts_json` is JSON-serialized ImageCallOptions.
|
|
33
33
|
* Returns JSON-serialized ImageResult (images as base64 in JSON).
|
|
34
34
|
*/
|
|
35
|
-
generate(optsJson: string): Promise<string>
|
|
35
|
+
generate(optsJson: string, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export declare class AbortBridge {
|
|
39
|
+
/**
|
|
40
|
+
* Bridge a JS `AbortSignal` to the core's runtime cancellation.
|
|
41
|
+
* Pass the result to `Model.generateText` / `Model.streamText`.
|
|
42
|
+
*/
|
|
43
|
+
constructor(signal: AbortSignal)
|
|
44
|
+
/** Returns `true` once the underlying JS signal has been aborted. */
|
|
45
|
+
aborted(): boolean
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
export declare class Model {
|
|
@@ -41,16 +51,17 @@ export declare class Model {
|
|
|
41
51
|
*
|
|
42
52
|
* `prompt` — a JSON string: bare prompt (`"text"` or `[{...}]`) or `{"prompt": ...}`.
|
|
43
53
|
* `options` — optional JSON-serialized `GenerateTextOptions`.
|
|
54
|
+
* `bridge` — optional `AbortBridge`; aborting the wrapped signal cancels the call.
|
|
44
55
|
* Returns a JSON-serialized `GenerateTextResult`.
|
|
45
56
|
*/
|
|
46
|
-
generateText(prompt: string, options?: string | undefined | null): Promise<string>
|
|
57
|
+
generateText(prompt: string, options?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
47
58
|
/**
|
|
48
59
|
* Stream text from the model.
|
|
49
60
|
*
|
|
50
61
|
* Returns an `AsyncGenerator<string>` yielding `StreamPart` JSON strings.
|
|
51
62
|
* Use `for await (const part of model.streamText(...))` to consume.
|
|
52
63
|
*/
|
|
53
|
-
streamText(prompt: string, options?: string | undefined | null): Promise<AsyncGenerator<string>>
|
|
64
|
+
streamText(prompt: string, options?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<AsyncGenerator<string>>
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
export declare class RerankingModel {
|
|
@@ -59,7 +70,7 @@ export declare class RerankingModel {
|
|
|
59
70
|
* array of documents, `opts_json` is optional JSON options.
|
|
60
71
|
* Returns JSON-serialized RerankingResult.
|
|
61
72
|
*/
|
|
62
|
-
rerank(query: string, docsJson: string, optsJson?: string | undefined | null): Promise<string>
|
|
73
|
+
rerank(query: string, docsJson: string, optsJson?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
63
74
|
}
|
|
64
75
|
|
|
65
76
|
export declare class SearchModel {
|
|
@@ -67,7 +78,7 @@ export declare class SearchModel {
|
|
|
67
78
|
* Search. `query` is the search query, `opts_json` is optional JSON options.
|
|
68
79
|
* Returns JSON-serialized SearchResult.
|
|
69
80
|
*/
|
|
70
|
-
search(query: string, optsJson?: string | undefined | null): Promise<string>
|
|
81
|
+
search(query: string, optsJson?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
71
82
|
}
|
|
72
83
|
|
|
73
84
|
export declare class SpeechModel {
|
|
@@ -75,7 +86,7 @@ export declare class SpeechModel {
|
|
|
75
86
|
* Generate speech audio. `opts_json` is JSON-serialized SpeechCallOptions.
|
|
76
87
|
* Returns JSON-serialized SpeechResult (audio as base64 in JSON).
|
|
77
88
|
*/
|
|
78
|
-
generate(optsJson: string): Promise<string>
|
|
89
|
+
generate(optsJson: string, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
79
90
|
}
|
|
80
91
|
|
|
81
92
|
/**
|
|
@@ -101,7 +112,7 @@ export declare class TranscriptionModel {
|
|
|
101
112
|
* `media_type` is e.g. "audio/mp3". `opts_json` is optional JSON options.
|
|
102
113
|
* Returns JSON-serialized TranscriptionResult.
|
|
103
114
|
*/
|
|
104
|
-
generate(audioBase64: string, mediaType: string, optsJson?: string | undefined | null): Promise<string>
|
|
115
|
+
generate(audioBase64: string, mediaType: string, optsJson?: string | undefined | null, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
export declare class VideoModel {
|
|
@@ -109,12 +120,33 @@ export declare class VideoModel {
|
|
|
109
120
|
* Generate video. `opts_json` is JSON-serialized VideoCallOptions.
|
|
110
121
|
* Returns JSON-serialized VideoResult (typically contains a URL).
|
|
111
122
|
*/
|
|
112
|
-
generate(optsJson: string): Promise<string>
|
|
123
|
+
generate(optsJson: string, bridge?: AbortBridge | undefined | null): Promise<string>
|
|
113
124
|
}
|
|
114
125
|
|
|
115
126
|
/** Create an Anthropic model instance. */
|
|
116
127
|
export declare function anthropic(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
117
128
|
|
|
129
|
+
/** Create an Anthropic-on-AWS model instance (API key + region). */
|
|
130
|
+
export declare function anthropicAws(apiKey: string, region: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
131
|
+
|
|
132
|
+
/** Create an Azure OpenAI model instance (API key + resource name). */
|
|
133
|
+
export declare function azure(apiKey: string, resourceName: string, deployment: string, apiVersion?: string | undefined | null, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
134
|
+
|
|
135
|
+
/** Create a Bedrock model instance (AWS SigV4 credentials). */
|
|
136
|
+
export declare function bedrock(accessKeyId: string, secretAccessKey: string, region: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
137
|
+
|
|
138
|
+
/** Create a Cohere model instance. */
|
|
139
|
+
export declare function cohere(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
140
|
+
|
|
141
|
+
/** Create a Mistral model instance. */
|
|
142
|
+
export declare function mistral(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
143
|
+
|
|
144
|
+
/** Create a Vertex AI model instance (GCP bearer token). */
|
|
145
|
+
export declare function vertex(accessToken: string, project: string, location: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
146
|
+
|
|
147
|
+
/** Create an xAI model instance. */
|
|
148
|
+
export declare function xai(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
149
|
+
|
|
118
150
|
/** Create a Cohere embedding model instance. */
|
|
119
151
|
export declare function cohereEmbedding(apiKey: string, modelId: string, baseUrl?: string | undefined | null): Promise<EmbeddingModel>
|
|
120
152
|
|
|
@@ -124,6 +156,12 @@ export declare function cohereReranking(apiKey: string, modelId: string, baseUrl
|
|
|
124
156
|
/** Create a DeepSeek model instance. */
|
|
125
157
|
export declare function deepseek(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
126
158
|
|
|
159
|
+
/** Create a Google Gemini language model instance (native generateContent protocol — not registry-backed). */
|
|
160
|
+
export declare function google(apiKey: string, modelId: string, config?: string | ProviderConfig | undefined | null): Promise<Model>
|
|
161
|
+
|
|
162
|
+
/** Create a language model from the built-in registry by provider name (RFC-0017 phase 4). */
|
|
163
|
+
export declare function provider(name: string, apiKey?: string | undefined | null, modelId: string, config?: ProviderConfig | undefined | null): Promise<Model>
|
|
164
|
+
|
|
127
165
|
/** Create a Google embedding model instance. */
|
|
128
166
|
export declare function googleEmbedding(apiKey: string, modelId: string, baseUrl?: string | undefined | null): Promise<EmbeddingModel>
|
|
129
167
|
|
package/index.js
CHANGED
|
@@ -714,6 +714,7 @@ module.exports.anthropic = nativeBinding.anthropic
|
|
|
714
714
|
module.exports.cohereEmbedding = nativeBinding.cohereEmbedding
|
|
715
715
|
module.exports.cohereReranking = nativeBinding.cohereReranking
|
|
716
716
|
module.exports.deepseek = nativeBinding.deepseek
|
|
717
|
+
module.exports.google = nativeBinding.google
|
|
717
718
|
module.exports.googleEmbedding = nativeBinding.googleEmbedding
|
|
718
719
|
module.exports.googleImage = nativeBinding.googleImage
|
|
719
720
|
module.exports.googleVideo = nativeBinding.googleVideo
|
|
@@ -723,4 +724,5 @@ module.exports.openaiFiles = nativeBinding.openaiFiles
|
|
|
723
724
|
module.exports.openaiImage = nativeBinding.openaiImage
|
|
724
725
|
module.exports.openaiSpeech = nativeBinding.openaiSpeech
|
|
725
726
|
module.exports.openaiTranscription = nativeBinding.openaiTranscription
|
|
727
|
+
module.exports.provider = nativeBinding.provider
|
|
726
728
|
module.exports.tavilySearch = nativeBinding.tavilySearch
|
package/package.json
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcships/aimux",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Unified LLM service layer — one API for
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Unified LLM service layer — one API for 325 AI providers (Rust core, Node.js binding)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"index.js",
|
|
9
9
|
"index.d.ts",
|
|
10
|
-
"dist/"
|
|
11
|
-
"*.node"
|
|
12
|
-
],
|
|
13
|
-
"os": [
|
|
14
|
-
"darwin",
|
|
15
|
-
"linux"
|
|
16
|
-
],
|
|
17
|
-
"cpu": [
|
|
18
|
-
"x64",
|
|
19
|
-
"arm64"
|
|
10
|
+
"dist/"
|
|
20
11
|
],
|
|
21
12
|
"repository": {
|
|
22
13
|
"type": "git",
|
|
@@ -34,20 +25,26 @@
|
|
|
34
25
|
"./package.json": "./package.json"
|
|
35
26
|
},
|
|
36
27
|
"napi": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
"binaryName": "aimux",
|
|
29
|
+
"packageName": "@arcships/aimux",
|
|
30
|
+
"targets": [
|
|
31
|
+
"x86_64-pc-windows-msvc",
|
|
32
|
+
"aarch64-pc-windows-msvc",
|
|
33
|
+
"x86_64-apple-darwin",
|
|
34
|
+
"aarch64-apple-darwin",
|
|
35
|
+
"x86_64-unknown-linux-gnu",
|
|
36
|
+
"aarch64-unknown-linux-gnu"
|
|
37
|
+
]
|
|
41
38
|
},
|
|
42
39
|
"scripts": {
|
|
43
40
|
"build": "napi build --platform --release",
|
|
44
41
|
"build:debug": "napi build --platform",
|
|
45
42
|
"build:typed": "tsc -p tsconfig.json",
|
|
46
43
|
"test": "ava",
|
|
47
|
-
"prepublishOnly": "npm run build:typed && napi prepublish -t npm"
|
|
44
|
+
"prepublishOnly": "npm run build:typed && napi prepublish -t npm --no-gh-release"
|
|
48
45
|
},
|
|
49
46
|
"devDependencies": {
|
|
50
|
-
"@napi-rs/cli": "
|
|
47
|
+
"@napi-rs/cli": "3.8.2",
|
|
51
48
|
"ava": "^6.0.0",
|
|
52
49
|
"typescript": "^5.5.0"
|
|
53
50
|
},
|
|
@@ -55,5 +52,12 @@
|
|
|
55
52
|
"node": ">= 18"
|
|
56
53
|
},
|
|
57
54
|
"license": "MIT",
|
|
58
|
-
"optionalDependencies": {
|
|
55
|
+
"optionalDependencies": {
|
|
56
|
+
"@arcships/aimux-win32-x64-msvc": "0.2.0",
|
|
57
|
+
"@arcships/aimux-win32-arm64-msvc": "0.2.0",
|
|
58
|
+
"@arcships/aimux-darwin-x64": "0.2.0",
|
|
59
|
+
"@arcships/aimux-darwin-arm64": "0.2.0",
|
|
60
|
+
"@arcships/aimux-linux-x64-gnu": "0.2.0",
|
|
61
|
+
"@arcships/aimux-linux-arm64-gnu": "0.2.0"
|
|
62
|
+
}
|
|
59
63
|
}
|
package/aimux.darwin-arm64.node
DELETED
|
Binary file
|
package/aimux.linux-x64-gnu.node
DELETED
|
Binary file
|