@broberg/ai-sdk 0.36.1 → 0.36.3
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 +2 -2
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2178,8 +2178,8 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
2178
2178
|
* wires the live adapters. */
|
|
2179
2179
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
2180
2180
|
|
|
2181
|
-
declare const VERSION: "0.36.
|
|
2182
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.36.
|
|
2181
|
+
declare const VERSION: "0.36.3";
|
|
2182
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.36.3";
|
|
2183
2183
|
|
|
2184
2184
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
2185
2185
|
* per-call override.
|
package/dist/index.js
CHANGED
|
@@ -1314,6 +1314,11 @@ function mistralAdapter(config = {}) {
|
|
|
1314
1314
|
const pagesProcessed = data.usage_info?.pages_processed ?? pages.length;
|
|
1315
1315
|
const usage = freshUsage({
|
|
1316
1316
|
provider: "mistral",
|
|
1317
|
+
// From the URL we actually called. mistral is deliberately ABSENT from the
|
|
1318
|
+
// provider-name table (config.baseUrl can move it), so omitting this here made
|
|
1319
|
+
// these four report "unknown" instead of "eu" — a regression shipped in 0.36.0
|
|
1320
|
+
// that broke the very enforcement we told consumers to write.
|
|
1321
|
+
region: regionOfHost(baseUrl),
|
|
1317
1322
|
model: req.spec.model,
|
|
1318
1323
|
transport: "http",
|
|
1319
1324
|
capability: "ocr",
|
|
@@ -1345,6 +1350,11 @@ function mistralAdapter(config = {}) {
|
|
|
1345
1350
|
const estIn = req.input.reduce((n, s) => n + Math.ceil(s.length / 4), 0);
|
|
1346
1351
|
const usage = freshUsage({
|
|
1347
1352
|
provider: "mistral",
|
|
1353
|
+
// From the URL we actually called. mistral is deliberately ABSENT from the
|
|
1354
|
+
// provider-name table (config.baseUrl can move it), so omitting this here made
|
|
1355
|
+
// these four report "unknown" instead of "eu" — a regression shipped in 0.36.0
|
|
1356
|
+
// that broke the very enforcement we told consumers to write.
|
|
1357
|
+
region: regionOfHost(baseUrl),
|
|
1348
1358
|
model: req.spec.model,
|
|
1349
1359
|
transport: "http",
|
|
1350
1360
|
capability: "moderation",
|
|
@@ -1367,6 +1377,11 @@ function mistralAdapter(config = {}) {
|
|
|
1367
1377
|
const vectors = (data.data ?? []).map((d) => d.embedding);
|
|
1368
1378
|
const usage = freshUsage({
|
|
1369
1379
|
provider: "mistral",
|
|
1380
|
+
// From the URL we actually called. mistral is deliberately ABSENT from the
|
|
1381
|
+
// provider-name table (config.baseUrl can move it), so omitting this here made
|
|
1382
|
+
// these four report "unknown" instead of "eu" — a regression shipped in 0.36.0
|
|
1383
|
+
// that broke the very enforcement we told consumers to write.
|
|
1384
|
+
region: regionOfHost(baseUrl),
|
|
1370
1385
|
model: req.spec.model,
|
|
1371
1386
|
transport: "http",
|
|
1372
1387
|
capability: "embedding",
|
|
@@ -1392,6 +1407,11 @@ function mistralAdapter(config = {}) {
|
|
|
1392
1407
|
const data = await res.json();
|
|
1393
1408
|
const usage = freshUsage({
|
|
1394
1409
|
provider: "mistral",
|
|
1410
|
+
// From the URL we actually called. mistral is deliberately ABSENT from the
|
|
1411
|
+
// provider-name table (config.baseUrl can move it), so omitting this here made
|
|
1412
|
+
// these four report "unknown" instead of "eu" — a regression shipped in 0.36.0
|
|
1413
|
+
// that broke the very enforcement we told consumers to write.
|
|
1414
|
+
region: regionOfHost(baseUrl),
|
|
1395
1415
|
model: req.spec.model,
|
|
1396
1416
|
transport: "http",
|
|
1397
1417
|
capability: "transcribe",
|
|
@@ -2966,8 +2986,8 @@ var aiConfigSchema = z.object({
|
|
|
2966
2986
|
});
|
|
2967
2987
|
|
|
2968
2988
|
// src/version.ts
|
|
2969
|
-
var VERSION = "0.36.
|
|
2970
|
-
var SDK_TAG = "@broberg/ai-sdk@0.36.
|
|
2989
|
+
var VERSION = "0.36.3";
|
|
2990
|
+
var SDK_TAG = "@broberg/ai-sdk@0.36.3";
|
|
2971
2991
|
|
|
2972
2992
|
// src/cost/sinks/upmetrics.ts
|
|
2973
2993
|
function upmetricsSink(config) {
|
|
@@ -3106,6 +3126,10 @@ function createAI(config = {}) {
|
|
|
3106
3126
|
assertOverrideProvider(base, override, label, providerNames);
|
|
3107
3127
|
return { ...base, ...override };
|
|
3108
3128
|
}
|
|
3129
|
+
function mergeUnguarded(base, override, why) {
|
|
3130
|
+
void why;
|
|
3131
|
+
return { ...base, ...override };
|
|
3132
|
+
}
|
|
3109
3133
|
function pickProvider(name) {
|
|
3110
3134
|
const adapter = Object.hasOwn(providers, name) ? providers[name] : void 0;
|
|
3111
3135
|
if (!adapter) {
|
|
@@ -3470,7 +3494,7 @@ function createAI(config = {}) {
|
|
|
3470
3494
|
});
|
|
3471
3495
|
const chars = input.script.reduce((n, t) => n + t.text.length, 0);
|
|
3472
3496
|
return runCapability({
|
|
3473
|
-
primary:
|
|
3497
|
+
primary: mergeUnguarded(DEFAULT_PODCAST_SPEC, input.override, "routes by voice, not by model \u2014 the adapter never sends spec.model"),
|
|
3474
3498
|
fallback: input.fallback,
|
|
3475
3499
|
capability: "podcast",
|
|
3476
3500
|
purpose: input.purpose,
|
|
@@ -3489,7 +3513,7 @@ function createAI(config = {}) {
|
|
|
3489
3513
|
input = ttsInputSchema.parse(input);
|
|
3490
3514
|
const { voiceId } = checkVoice(input.voice, { fallback: input.voiceFallback, throwIfUnavailable: true });
|
|
3491
3515
|
return runCapability({
|
|
3492
|
-
primary:
|
|
3516
|
+
primary: mergeUnguarded(DEFAULT_TTS_SPEC, input.override, "routes by voice, not by model \u2014 the adapter never sends spec.model"),
|
|
3493
3517
|
fallback: input.fallback,
|
|
3494
3518
|
capability: "tts",
|
|
3495
3519
|
purpose: input.purpose,
|
|
@@ -3528,7 +3552,7 @@ function createAI(config = {}) {
|
|
|
3528
3552
|
input = transcribeInputSchema.parse(input);
|
|
3529
3553
|
const audio = await resolveAudio(input.audio);
|
|
3530
3554
|
return runCapability({
|
|
3531
|
-
primary:
|
|
3555
|
+
primary: mergeUnguarded(DEFAULT_TRANSCRIBE_SPEC, input.override, "routes by voice, not by model \u2014 the adapter never sends spec.model"),
|
|
3532
3556
|
fallback: input.fallback,
|
|
3533
3557
|
capability: "transcribe",
|
|
3534
3558
|
purpose: input.purpose,
|