@broberg/ai-sdk 0.36.2 → 0.36.4
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 +14 -3
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,17 @@ export { AvailabilitySource, AvailabilityStatus, ModelStatus, ModelUnavailableEr
|
|
|
15
15
|
* it passes every OpenRouter call. Only `region === "eu"` may be treated as EU-resident.
|
|
16
16
|
*/
|
|
17
17
|
type Region = "eu" | "us" | "cn" | "unknown";
|
|
18
|
+
/** Region of the endpoint a call will actually hit. Never throws — a residency
|
|
19
|
+
* reading must not be able to break a call that already succeeded. */
|
|
20
|
+
declare function regionOfHost(url: string | undefined): Region;
|
|
21
|
+
/** Classify a provider REGION STRING — a Vertex/GCP location like `europe-west1`, or
|
|
22
|
+
* an Azure region like `westeurope`. Anything unrecognised is `"unknown"`: a region
|
|
23
|
+
* name we have never seen is exactly the case where guessing is most tempting and
|
|
24
|
+
* least defensible. Never throws — a residency reading must not be able to break a
|
|
25
|
+
* call that already succeeded. */
|
|
26
|
+
declare function classifyRegionName(name: string | undefined): Region;
|
|
27
|
+
/** Region for an adapter whose endpoint is fixed. Unknown provider → `"unknown"`. */
|
|
28
|
+
declare function regionOfProvider(provider: string): Region;
|
|
18
29
|
|
|
19
30
|
/** How a call reaches the model. `http` = provider REST API; `subprocess` = local
|
|
20
31
|
* `claude -p` CLI (Max plan, costUsd 0). */
|
|
@@ -2178,8 +2189,8 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
2178
2189
|
* wires the live adapters. */
|
|
2179
2190
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
2180
2191
|
|
|
2181
|
-
declare const VERSION: "0.36.
|
|
2182
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.36.
|
|
2192
|
+
declare const VERSION: "0.36.4";
|
|
2193
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.36.4";
|
|
2183
2194
|
|
|
2184
2195
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
2185
2196
|
* per-call override.
|
|
@@ -2590,4 +2601,4 @@ interface StreamTransportRequest extends TransportRequest {
|
|
|
2590
2601
|
*/
|
|
2591
2602
|
declare function streamTransport(req: StreamTransportRequest): AsyncIterable<string>;
|
|
2592
2603
|
|
|
2593
|
-
export { AZURE_DANISH_VOICES, AZURE_DANISH_VOICE_LIST, type AiClient, type AiConfig, type AzureVoiceInfo, type BatchJob, type BatchRequestItem, type BatchResultItem, type BflAdapterConfig, type BflCredits, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type CheckVoiceOptions, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostQuery, type CostSink, type CostSummary, type CostSummaryQuery, type CostTimeseriesQuery, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DialogueRequest, type DialogueTurn, type DiscordSinkConfig, ELEVENLABS_DANISH_VOICES, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type LoraWeight, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PodcastInput, type PodcastResult, type PricingEntry, type ProviderAdapter, type RefreshOptions, type RefreshResult, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TrainStyleInput, type TrainStyleRequest, type TrainStyleResult, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type TtsInput, type TtsRequest, type UpmetricsCostClientConfig, UpmetricsCostError, type UpmetricsCostRow, type UpmetricsCostSummary, type UpmetricsCostTimeseries, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, type VoiceInfo, type VoiceProvider, type VoiceResolveResult, type VoiceStatus, VoiceUnavailableError, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, azureAdapter, bflAdapter, bflCredits, chatInputSchema, checkVoice, computeCost, createAI, deepinfraAdapter, deeplAdapter, deepseekAdapter, defaultProviders, discordSink, elevenlabsAdapter, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, listAzureDanishVoices, listVoices, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, mistralStubAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, refreshAvailability, requestyAdapter, resetRefreshState, resetRegistry, resolveAzureVoice, resolveTier, resolveVoice, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsCostClient, upmetricsSink, usdFromMicro, vertexAdapter, visionInputSchema };
|
|
2604
|
+
export { AZURE_DANISH_VOICES, AZURE_DANISH_VOICE_LIST, type AiClient, type AiConfig, type AzureVoiceInfo, type BatchJob, type BatchRequestItem, type BatchResultItem, type BflAdapterConfig, type BflCredits, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type CheckVoiceOptions, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostQuery, type CostSink, type CostSummary, type CostSummaryQuery, type CostTimeseriesQuery, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DialogueRequest, type DialogueTurn, type DiscordSinkConfig, ELEVENLABS_DANISH_VOICES, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type LoraWeight, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PodcastInput, type PodcastResult, type PricingEntry, type ProviderAdapter, type RefreshOptions, type RefreshResult, type Region, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TrainStyleInput, type TrainStyleRequest, type TrainStyleResult, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type TtsInput, type TtsRequest, type UpmetricsCostClientConfig, UpmetricsCostError, type UpmetricsCostRow, type UpmetricsCostSummary, type UpmetricsCostTimeseries, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, type VoiceInfo, type VoiceProvider, type VoiceResolveResult, type VoiceStatus, VoiceUnavailableError, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, azureAdapter, bflAdapter, bflCredits, chatInputSchema, checkVoice, classifyRegionName, computeCost, createAI, deepinfraAdapter, deeplAdapter, deepseekAdapter, defaultProviders, discordSink, elevenlabsAdapter, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, listAzureDanishVoices, listVoices, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, mistralStubAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, refreshAvailability, regionOfHost, regionOfProvider, requestyAdapter, resetRefreshState, resetRegistry, resolveAzureVoice, resolveTier, resolveVoice, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsCostClient, upmetricsSink, usdFromMicro, vertexAdapter, visionInputSchema };
|
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.4";
|
|
2990
|
+
var SDK_TAG = "@broberg/ai-sdk@0.36.4";
|
|
2971
2991
|
|
|
2972
2992
|
// src/cost/sinks/upmetrics.ts
|
|
2973
2993
|
function upmetricsSink(config) {
|
|
@@ -3971,6 +3991,7 @@ export {
|
|
|
3971
3991
|
bflCredits,
|
|
3972
3992
|
chatInputSchema,
|
|
3973
3993
|
checkVoice,
|
|
3994
|
+
classifyRegionName,
|
|
3974
3995
|
computeCost,
|
|
3975
3996
|
createAI,
|
|
3976
3997
|
deepinfraAdapter,
|
|
@@ -4005,6 +4026,8 @@ export {
|
|
|
4005
4026
|
parseClaudeCliJson,
|
|
4006
4027
|
parseJsonLoose,
|
|
4007
4028
|
refreshAvailability,
|
|
4029
|
+
regionOfHost,
|
|
4030
|
+
regionOfProvider,
|
|
4008
4031
|
requestyAdapter,
|
|
4009
4032
|
resetRefreshState,
|
|
4010
4033
|
resetRegistry,
|