llm-strings 1.2.0 → 1.4.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/README.md +3 -14
- package/dist/ai-sdk.cjs +355 -10
- package/dist/ai-sdk.d.cts +5 -4
- package/dist/ai-sdk.d.ts +5 -4
- package/dist/ai-sdk.js +87 -9
- package/dist/{chunk-BCOUH7LH.js → chunk-5YTG2NRX.js} +1 -2
- package/dist/{chunk-W4NIQY7M.js → chunk-76EFNZCF.js} +317 -4
- package/dist/{chunk-2ARD4TFU.js → chunk-DPVT3FFP.js} +1 -2
- package/dist/{chunk-RPXK2A7O.js → chunk-OBLFZFNR.js} +3 -4
- package/dist/index.cjs +317 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -5
- package/dist/normalize.cjs +157 -4
- package/dist/normalize.d.cts +1 -1
- package/dist/normalize.d.ts +1 -1
- package/dist/normalize.js +2 -3
- package/dist/parse.cjs +27 -1
- package/dist/parse.d.cts +1 -1
- package/dist/parse.d.ts +1 -1
- package/dist/parse.js +2 -3
- package/dist/{provider-core-BiAl8MCV.d.cts → provider-core-B934MuhJ.d.cts} +2 -2
- package/dist/{provider-core-BiAl8MCV.d.ts → provider-core-B934MuhJ.d.ts} +2 -2
- package/dist/providers.cjs +451 -445
- package/dist/providers.d.cts +3 -8
- package/dist/providers.d.ts +3 -8
- package/dist/providers.js +135 -442
- package/dist/validate.cjs +317 -4
- package/dist/validate.js +4 -5
- package/package.json +1 -1
- package/dist/ai-sdk.cjs.map +0 -1
- package/dist/ai-sdk.js.map +0 -1
- package/dist/chunk-2ARD4TFU.js.map +0 -1
- package/dist/chunk-BCOUH7LH.js.map +0 -1
- package/dist/chunk-RPXK2A7O.js.map +0 -1
- package/dist/chunk-W4NIQY7M.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/normalize.cjs.map +0 -1
- package/dist/normalize.js.map +0 -1
- package/dist/parse.cjs.map +0 -1
- package/dist/parse.js.map +0 -1
- package/dist/providers.cjs.map +0 -1
- package/dist/providers.js.map +0 -1
- package/dist/validate.cjs.map +0 -1
- package/dist/validate.js.map +0 -1
package/dist/normalize.cjs
CHANGED
|
@@ -28,11 +28,26 @@ module.exports = __toCommonJS(normalize_exports);
|
|
|
28
28
|
function hasOwn(object, key) {
|
|
29
29
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
30
30
|
}
|
|
31
|
+
var HOST_ALIAS_PROVIDERS = {
|
|
32
|
+
aistudio: "google",
|
|
33
|
+
vertex: "google-vertex",
|
|
34
|
+
grok: "xai",
|
|
35
|
+
bfl: "black-forest-labs",
|
|
36
|
+
moonshot: "moonshotai",
|
|
37
|
+
alibaba: "alibaba",
|
|
38
|
+
alibabacloud: "alibaba",
|
|
39
|
+
dashscope: "alibaba",
|
|
40
|
+
togetherai: "together",
|
|
41
|
+
fireworksai: "fireworks"
|
|
42
|
+
};
|
|
31
43
|
function providerFromHostAlias(alias) {
|
|
32
44
|
const normalizedAlias = alias.toLowerCase();
|
|
33
45
|
if (hasOwn(PROVIDER_PARAMS, normalizedAlias)) {
|
|
34
46
|
return normalizedAlias;
|
|
35
47
|
}
|
|
48
|
+
if (hasOwn(HOST_ALIAS_PROVIDERS, normalizedAlias)) {
|
|
49
|
+
return HOST_ALIAS_PROVIDERS[normalizedAlias];
|
|
50
|
+
}
|
|
36
51
|
return void 0;
|
|
37
52
|
}
|
|
38
53
|
function detectProvider(host) {
|
|
@@ -40,6 +55,34 @@ function detectProvider(host) {
|
|
|
40
55
|
if (host.includes("openrouter")) return "openrouter";
|
|
41
56
|
if (host.includes("gateway.ai.vercel")) return "vercel";
|
|
42
57
|
if (host.includes("amazonaws") || host.includes("bedrock")) return "bedrock";
|
|
58
|
+
if (host.includes("aiplatform.googleapis")) return "google-vertex";
|
|
59
|
+
if (host.includes("api.x.ai")) return "xai";
|
|
60
|
+
if (host.includes("groq")) return "groq";
|
|
61
|
+
if (host.includes("fal.run") || host.includes("fal.ai")) return "fal";
|
|
62
|
+
if (host.includes("deepinfra")) return "deepinfra";
|
|
63
|
+
if (host.includes("bfl.ai")) return "black-forest-labs";
|
|
64
|
+
if (host.includes("together")) return "together";
|
|
65
|
+
if (host.includes("fireworks")) return "fireworks";
|
|
66
|
+
if (host.includes("deepseek")) return "deepseek";
|
|
67
|
+
if (host.includes("moonshot")) return "moonshotai";
|
|
68
|
+
if (host.includes("perplexity")) return "perplexity";
|
|
69
|
+
if (host.includes("dashscope") || host.includes("aliyuncs")) return "alibaba";
|
|
70
|
+
if (host.includes("cerebras")) return "cerebras";
|
|
71
|
+
if (host.includes("replicate")) return "replicate";
|
|
72
|
+
if (host.includes("prodia")) return "prodia";
|
|
73
|
+
if (host.includes("lumalabs") || host.includes("luma")) return "luma";
|
|
74
|
+
if (host.includes("volces") || host.includes("bytedance")) return "bytedance";
|
|
75
|
+
if (host.includes("kling")) return "kling";
|
|
76
|
+
if (host.includes("elevenlabs")) return "elevenlabs";
|
|
77
|
+
if (host.includes("assemblyai")) return "assemblyai";
|
|
78
|
+
if (host.includes("deepgram")) return "deepgram";
|
|
79
|
+
if (host.includes("gladia")) return "gladia";
|
|
80
|
+
if (host.includes("lmnt")) return "lmnt";
|
|
81
|
+
if (host.includes("hume")) return "hume";
|
|
82
|
+
if (host.includes("rev.ai")) return "revai";
|
|
83
|
+
if (host.includes("baseten")) return "baseten";
|
|
84
|
+
if (host.includes("huggingface")) return "huggingface";
|
|
85
|
+
if (host.includes("azure")) return "azure";
|
|
43
86
|
if (host.includes("openai")) return "openai";
|
|
44
87
|
if (host.includes("anthropic") || host.includes("claude")) return "anthropic";
|
|
45
88
|
if (host.includes("googleapis") || host.includes("google")) return "google";
|
|
@@ -94,6 +137,33 @@ var ALIASES = {
|
|
|
94
137
|
cachePoint: "cache",
|
|
95
138
|
cache_point: "cache"
|
|
96
139
|
};
|
|
140
|
+
var OPENAI_COMPATIBLE_PARAMS = {
|
|
141
|
+
temperature: "temperature",
|
|
142
|
+
max_tokens: "max_tokens",
|
|
143
|
+
top_p: "top_p",
|
|
144
|
+
top_k: "top_k",
|
|
145
|
+
frequency_penalty: "frequency_penalty",
|
|
146
|
+
presence_penalty: "presence_penalty",
|
|
147
|
+
stop: "stop",
|
|
148
|
+
n: "n",
|
|
149
|
+
seed: "seed",
|
|
150
|
+
stream: "stream",
|
|
151
|
+
effort: "reasoning_effort"
|
|
152
|
+
};
|
|
153
|
+
var GOOGLE_COMPATIBLE_PARAMS = {
|
|
154
|
+
temperature: "temperature",
|
|
155
|
+
max_tokens: "maxOutputTokens",
|
|
156
|
+
top_p: "topP",
|
|
157
|
+
top_k: "topK",
|
|
158
|
+
frequency_penalty: "frequencyPenalty",
|
|
159
|
+
presence_penalty: "presencePenalty",
|
|
160
|
+
stop: "stopSequences",
|
|
161
|
+
n: "candidateCount",
|
|
162
|
+
stream: "stream",
|
|
163
|
+
seed: "seed",
|
|
164
|
+
responseMimeType: "responseMimeType",
|
|
165
|
+
responseSchema: "responseSchema"
|
|
166
|
+
};
|
|
97
167
|
var PROVIDER_PARAMS = {
|
|
98
168
|
openai: {
|
|
99
169
|
temperature: "temperature",
|
|
@@ -107,6 +177,7 @@ var PROVIDER_PARAMS = {
|
|
|
107
177
|
stream: "stream",
|
|
108
178
|
effort: "reasoning_effort"
|
|
109
179
|
},
|
|
180
|
+
azure: OPENAI_COMPATIBLE_PARAMS,
|
|
110
181
|
anthropic: {
|
|
111
182
|
temperature: "temperature",
|
|
112
183
|
max_tokens: "max_tokens",
|
|
@@ -132,6 +203,7 @@ var PROVIDER_PARAMS = {
|
|
|
132
203
|
responseMimeType: "responseMimeType",
|
|
133
204
|
responseSchema: "responseSchema"
|
|
134
205
|
},
|
|
206
|
+
"google-vertex": GOOGLE_COMPATIBLE_PARAMS,
|
|
135
207
|
mistral: {
|
|
136
208
|
temperature: "temperature",
|
|
137
209
|
max_tokens: "max_tokens",
|
|
@@ -195,7 +267,33 @@ var PROVIDER_PARAMS = {
|
|
|
195
267
|
seed: "seed",
|
|
196
268
|
stream: "stream",
|
|
197
269
|
effort: "reasoning_effort"
|
|
198
|
-
}
|
|
270
|
+
},
|
|
271
|
+
xai: OPENAI_COMPATIBLE_PARAMS,
|
|
272
|
+
groq: OPENAI_COMPATIBLE_PARAMS,
|
|
273
|
+
fal: {},
|
|
274
|
+
deepinfra: OPENAI_COMPATIBLE_PARAMS,
|
|
275
|
+
"black-forest-labs": {},
|
|
276
|
+
together: OPENAI_COMPATIBLE_PARAMS,
|
|
277
|
+
fireworks: OPENAI_COMPATIBLE_PARAMS,
|
|
278
|
+
deepseek: OPENAI_COMPATIBLE_PARAMS,
|
|
279
|
+
moonshotai: OPENAI_COMPATIBLE_PARAMS,
|
|
280
|
+
perplexity: OPENAI_COMPATIBLE_PARAMS,
|
|
281
|
+
alibaba: OPENAI_COMPATIBLE_PARAMS,
|
|
282
|
+
cerebras: OPENAI_COMPATIBLE_PARAMS,
|
|
283
|
+
replicate: {},
|
|
284
|
+
prodia: {},
|
|
285
|
+
luma: {},
|
|
286
|
+
bytedance: {},
|
|
287
|
+
kling: {},
|
|
288
|
+
elevenlabs: {},
|
|
289
|
+
assemblyai: {},
|
|
290
|
+
deepgram: {},
|
|
291
|
+
gladia: {},
|
|
292
|
+
lmnt: {},
|
|
293
|
+
hume: {},
|
|
294
|
+
revai: {},
|
|
295
|
+
baseten: OPENAI_COMPATIBLE_PARAMS,
|
|
296
|
+
huggingface: OPENAI_COMPATIBLE_PARAMS
|
|
199
297
|
};
|
|
200
298
|
function isReasoningModel(model) {
|
|
201
299
|
const name = model.includes("/") ? model.split("/").pop() : model;
|
|
@@ -245,28 +343,84 @@ function bedrockSupportsCaching(model) {
|
|
|
245
343
|
var CACHE_VALUES = {
|
|
246
344
|
openai: void 0,
|
|
247
345
|
// OpenAI auto-caches; no explicit param
|
|
346
|
+
azure: void 0,
|
|
248
347
|
anthropic: "ephemeral",
|
|
249
348
|
google: void 0,
|
|
250
349
|
// Google uses explicit caching API, not a param
|
|
350
|
+
"google-vertex": void 0,
|
|
251
351
|
mistral: void 0,
|
|
252
352
|
cohere: void 0,
|
|
253
353
|
bedrock: "ephemeral",
|
|
254
354
|
// Supported for Claude models on Bedrock
|
|
255
355
|
openrouter: void 0,
|
|
256
356
|
// Depends on underlying provider
|
|
257
|
-
vercel: void 0
|
|
357
|
+
vercel: void 0,
|
|
258
358
|
// Depends on underlying provider
|
|
359
|
+
xai: void 0,
|
|
360
|
+
groq: void 0,
|
|
361
|
+
fal: void 0,
|
|
362
|
+
deepinfra: void 0,
|
|
363
|
+
"black-forest-labs": void 0,
|
|
364
|
+
together: void 0,
|
|
365
|
+
fireworks: void 0,
|
|
366
|
+
deepseek: void 0,
|
|
367
|
+
moonshotai: void 0,
|
|
368
|
+
perplexity: void 0,
|
|
369
|
+
alibaba: void 0,
|
|
370
|
+
cerebras: void 0,
|
|
371
|
+
replicate: void 0,
|
|
372
|
+
prodia: void 0,
|
|
373
|
+
luma: void 0,
|
|
374
|
+
bytedance: void 0,
|
|
375
|
+
kling: void 0,
|
|
376
|
+
elevenlabs: void 0,
|
|
377
|
+
assemblyai: void 0,
|
|
378
|
+
deepgram: void 0,
|
|
379
|
+
gladia: void 0,
|
|
380
|
+
lmnt: void 0,
|
|
381
|
+
hume: void 0,
|
|
382
|
+
revai: void 0,
|
|
383
|
+
baseten: void 0,
|
|
384
|
+
huggingface: void 0
|
|
259
385
|
};
|
|
260
386
|
var CACHE_TTLS = {
|
|
261
387
|
openai: void 0,
|
|
388
|
+
azure: void 0,
|
|
262
389
|
anthropic: ["5m", "1h"],
|
|
263
390
|
google: void 0,
|
|
391
|
+
"google-vertex": void 0,
|
|
264
392
|
mistral: void 0,
|
|
265
393
|
cohere: void 0,
|
|
266
394
|
bedrock: ["5m", "1h"],
|
|
267
395
|
// Claude on Bedrock uses same TTLs as direct Anthropic
|
|
268
396
|
openrouter: void 0,
|
|
269
|
-
vercel: void 0
|
|
397
|
+
vercel: void 0,
|
|
398
|
+
xai: void 0,
|
|
399
|
+
groq: void 0,
|
|
400
|
+
fal: void 0,
|
|
401
|
+
deepinfra: void 0,
|
|
402
|
+
"black-forest-labs": void 0,
|
|
403
|
+
together: void 0,
|
|
404
|
+
fireworks: void 0,
|
|
405
|
+
deepseek: void 0,
|
|
406
|
+
moonshotai: void 0,
|
|
407
|
+
perplexity: void 0,
|
|
408
|
+
alibaba: void 0,
|
|
409
|
+
cerebras: void 0,
|
|
410
|
+
replicate: void 0,
|
|
411
|
+
prodia: void 0,
|
|
412
|
+
luma: void 0,
|
|
413
|
+
bytedance: void 0,
|
|
414
|
+
kling: void 0,
|
|
415
|
+
elevenlabs: void 0,
|
|
416
|
+
assemblyai: void 0,
|
|
417
|
+
deepgram: void 0,
|
|
418
|
+
gladia: void 0,
|
|
419
|
+
lmnt: void 0,
|
|
420
|
+
hume: void 0,
|
|
421
|
+
revai: void 0,
|
|
422
|
+
baseten: void 0,
|
|
423
|
+
huggingface: void 0
|
|
270
424
|
};
|
|
271
425
|
var DURATION_RE = /^\d+[mh]$/;
|
|
272
426
|
|
|
@@ -371,4 +525,3 @@ function normalize(config, options = {}) {
|
|
|
371
525
|
0 && (module.exports = {
|
|
372
526
|
normalize
|
|
373
527
|
});
|
|
374
|
-
//# sourceMappingURL=normalize.cjs.map
|
package/dist/normalize.d.cts
CHANGED
package/dist/normalize.d.ts
CHANGED
package/dist/normalize.js
CHANGED
package/dist/parse.cjs
CHANGED
|
@@ -31,8 +31,10 @@ function hasOwn(object, key) {
|
|
|
31
31
|
}
|
|
32
32
|
var HOST_ALIASES = {
|
|
33
33
|
openai: "api.openai.com",
|
|
34
|
+
azure: "models.inference.ai.azure.com",
|
|
34
35
|
anthropic: "api.anthropic.com",
|
|
35
36
|
google: "generativelanguage.googleapis.com",
|
|
37
|
+
"google-vertex": "aiplatform.googleapis.com",
|
|
36
38
|
aistudio: "generativelanguage.googleapis.com",
|
|
37
39
|
mistral: "api.mistral.ai",
|
|
38
40
|
cohere: "api.cohere.com",
|
|
@@ -42,8 +44,16 @@ var HOST_ALIASES = {
|
|
|
42
44
|
alibaba: "dashscope-intl.aliyuncs.com",
|
|
43
45
|
alibabacloud: "dashscope-intl.aliyuncs.com",
|
|
44
46
|
dashscope: "dashscope-intl.aliyuncs.com",
|
|
47
|
+
groq: "api.groq.com",
|
|
48
|
+
fal: "fal.run",
|
|
45
49
|
fireworks: "api.fireworks.ai",
|
|
46
50
|
fireworksai: "api.fireworks.ai",
|
|
51
|
+
"black-forest-labs": "api.bfl.ai",
|
|
52
|
+
bfl: "api.bfl.ai",
|
|
53
|
+
deepseek: "api.deepseek.com",
|
|
54
|
+
moonshotai: "api.moonshot.ai",
|
|
55
|
+
moonshot: "api.moonshot.ai",
|
|
56
|
+
perplexity: "api.perplexity.ai",
|
|
47
57
|
venice: "api.venice.ai",
|
|
48
58
|
parasail: "api.parasail.io",
|
|
49
59
|
deepinfra: "api.deepinfra.com",
|
|
@@ -52,6 +62,23 @@ var HOST_ALIASES = {
|
|
|
52
62
|
novitaai: "api.novita.ai",
|
|
53
63
|
grok: "api.x.ai",
|
|
54
64
|
xai: "api.x.ai",
|
|
65
|
+
together: "api.together.xyz",
|
|
66
|
+
togetherai: "api.together.xyz",
|
|
67
|
+
cerebras: "api.cerebras.ai",
|
|
68
|
+
replicate: "api.replicate.com",
|
|
69
|
+
prodia: "api.prodia.com",
|
|
70
|
+
luma: "api.lumalabs.ai",
|
|
71
|
+
bytedance: "ark.cn-beijing.volces.com",
|
|
72
|
+
kling: "api.klingai.com",
|
|
73
|
+
elevenlabs: "api.elevenlabs.io",
|
|
74
|
+
assemblyai: "api.assemblyai.com",
|
|
75
|
+
deepgram: "api.deepgram.com",
|
|
76
|
+
gladia: "api.gladia.io",
|
|
77
|
+
lmnt: "api.lmnt.com",
|
|
78
|
+
hume: "api.hume.ai",
|
|
79
|
+
revai: "api.rev.ai",
|
|
80
|
+
baseten: "api.baseten.co",
|
|
81
|
+
huggingface: "api-inference.huggingface.co",
|
|
55
82
|
wandb: "api.inference.wandb.ai",
|
|
56
83
|
weightsandbiases: "api.inference.wandb.ai",
|
|
57
84
|
baidu: "qianfan.baidubce.com",
|
|
@@ -130,4 +157,3 @@ function build(config) {
|
|
|
130
157
|
build,
|
|
131
158
|
parse
|
|
132
159
|
});
|
|
133
|
-
//# sourceMappingURL=parse.cjs.map
|
package/dist/parse.d.cts
CHANGED
package/dist/parse.d.ts
CHANGED
package/dist/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
type Provider = "openai" | "anthropic" | "google" | "mistral" | "cohere" | "bedrock" | "openrouter" | "vercel";
|
|
2
|
-
type HostAlias = Provider | "aistudio" | "alibaba" | "alibabacloud" | "atlascloud" | "baidu" | "dashscope" | "deepinfra" | "fireworks" | "fireworksai" | "grok" | "minimax" | "novita" | "novitaai" | "parasail" | "qianfan" | "vertex" | "venice" | "wandb" | "weightsandbiases" | "xai" | "xiaomi";
|
|
1
|
+
type Provider = "openai" | "azure" | "anthropic" | "google" | "google-vertex" | "mistral" | "cohere" | "bedrock" | "openrouter" | "vercel" | "xai" | "groq" | "fal" | "deepinfra" | "black-forest-labs" | "together" | "fireworks" | "deepseek" | "moonshotai" | "perplexity" | "alibaba" | "cerebras" | "replicate" | "prodia" | "luma" | "bytedance" | "kling" | "elevenlabs" | "assemblyai" | "deepgram" | "gladia" | "lmnt" | "hume" | "revai" | "baseten" | "huggingface";
|
|
2
|
+
type HostAlias = Provider | "aistudio" | "alibaba" | "alibabacloud" | "atlascloud" | "baidu" | "cerebras" | "dashscope" | "deepinfra" | "deepseek" | "fireworks" | "fireworksai" | "groq" | "grok" | "bfl" | "minimax" | "moonshot" | "novita" | "novitaai" | "parasail" | "perplexity" | "qianfan" | "together" | "togetherai" | "vertex" | "venice" | "wandb" | "weightsandbiases" | "xai" | "xiaomi";
|
|
3
3
|
type Env = Record<string, string | undefined>;
|
|
4
4
|
declare const HOST_ALIASES: Record<HostAlias, string>;
|
|
5
5
|
interface HostResolution {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
type Provider = "openai" | "anthropic" | "google" | "mistral" | "cohere" | "bedrock" | "openrouter" | "vercel";
|
|
2
|
-
type HostAlias = Provider | "aistudio" | "alibaba" | "alibabacloud" | "atlascloud" | "baidu" | "dashscope" | "deepinfra" | "fireworks" | "fireworksai" | "grok" | "minimax" | "novita" | "novitaai" | "parasail" | "qianfan" | "vertex" | "venice" | "wandb" | "weightsandbiases" | "xai" | "xiaomi";
|
|
1
|
+
type Provider = "openai" | "azure" | "anthropic" | "google" | "google-vertex" | "mistral" | "cohere" | "bedrock" | "openrouter" | "vercel" | "xai" | "groq" | "fal" | "deepinfra" | "black-forest-labs" | "together" | "fireworks" | "deepseek" | "moonshotai" | "perplexity" | "alibaba" | "cerebras" | "replicate" | "prodia" | "luma" | "bytedance" | "kling" | "elevenlabs" | "assemblyai" | "deepgram" | "gladia" | "lmnt" | "hume" | "revai" | "baseten" | "huggingface";
|
|
2
|
+
type HostAlias = Provider | "aistudio" | "alibaba" | "alibabacloud" | "atlascloud" | "baidu" | "cerebras" | "dashscope" | "deepinfra" | "deepseek" | "fireworks" | "fireworksai" | "groq" | "grok" | "bfl" | "minimax" | "moonshot" | "novita" | "novitaai" | "parasail" | "perplexity" | "qianfan" | "together" | "togetherai" | "vertex" | "venice" | "wandb" | "weightsandbiases" | "xai" | "xiaomi";
|
|
3
3
|
type Env = Record<string, string | undefined>;
|
|
4
4
|
declare const HOST_ALIASES: Record<HostAlias, string>;
|
|
5
5
|
interface HostResolution {
|