@bivelio/savings-layer 0.4.21 → 0.4.22
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 +20 -8
- package/dist/gateway/bin.js +299 -299
- package/dist/index.d.ts +31 -3
- package/dist/index.js +537 -533
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -205,7 +205,7 @@ declare function precioDeLista(model: string): CostModel | undefined;
|
|
|
205
205
|
* on the customer's machine. `test/version-declarada.test.ts` ties this
|
|
206
206
|
* constant to package.json so the two can never drift.
|
|
207
207
|
*/
|
|
208
|
-
declare const BV_SALA_VERSION = "0.4.
|
|
208
|
+
declare const BV_SALA_VERSION = "0.4.22";
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
211
|
* Environment-agnostic UUID generation.
|
|
@@ -2387,7 +2387,18 @@ declare function createMockProvider(options?: MockProviderOptions): Provider;
|
|
|
2387
2387
|
interface OpenAICompatibleOptions {
|
|
2388
2388
|
baseUrl: string;
|
|
2389
2389
|
apiKey?: string;
|
|
2390
|
-
/**
|
|
2390
|
+
/**
|
|
2391
|
+
* Strip the `provider/` prefix from model ids before sending (`openai/gpt-4o-mini`
|
|
2392
|
+
* → `gpt-4o-mini`).
|
|
2393
|
+
*
|
|
2394
|
+
* Default (undefined): strip when `baseUrl` is OpenAI's own API or an Azure
|
|
2395
|
+
* OpenAI endpoint, keep otherwise. OpenAI rejects a prefixed id with a 404
|
|
2396
|
+
* ("model does not exist"), so the qualified ids the layer uses everywhere
|
|
2397
|
+
* else — pricing, cache keys, the report — would break the very first call
|
|
2398
|
+
* that reaches the provider. A gateway or a self-hosted server with a
|
|
2399
|
+
* namespaced model name usually WANTS the prefix, so it is kept there. Set `true`/`false` to decide explicitly; an explicit value
|
|
2400
|
+
* always wins.
|
|
2401
|
+
*/
|
|
2391
2402
|
stripProviderPrefix?: boolean;
|
|
2392
2403
|
/** Extra headers (e.g. for a gateway). */
|
|
2393
2404
|
headers?: Record<string, string>;
|
|
@@ -2417,6 +2428,13 @@ interface OpenAICompatibleOptions {
|
|
|
2417
2428
|
* es una restricción de OpenAI que JSON Schema no tiene.
|
|
2418
2429
|
*/
|
|
2419
2430
|
declare function isStrictCompatible(schema: unknown): boolean;
|
|
2431
|
+
/**
|
|
2432
|
+
* Decides the id that travels on the wire. Explicit option wins; otherwise the
|
|
2433
|
+
* endpoint decides: OpenAI/Azure get the bare id, everything else keeps what
|
|
2434
|
+
* the caller wrote. Exported for the pipeline-level test that pins the README
|
|
2435
|
+
* snippet; not part of the public API.
|
|
2436
|
+
*/
|
|
2437
|
+
declare function quitarPrefijoDeProveedor(model: string, explicito: boolean | undefined, baseUrl: string): string;
|
|
2420
2438
|
declare class OpenAICompatibleProvider implements Provider {
|
|
2421
2439
|
readonly id: string;
|
|
2422
2440
|
private readonly opts;
|
|
@@ -2448,6 +2466,14 @@ interface AnthropicOptions {
|
|
|
2448
2466
|
apiKey?: string;
|
|
2449
2467
|
/** Defaults to the public API. Override for a gateway or a proxy. */
|
|
2450
2468
|
baseUrl?: string;
|
|
2469
|
+
/**
|
|
2470
|
+
* Strip the `provider/` prefix from model ids before sending
|
|
2471
|
+
* (`anthropic/claude-sonnet-4-5` → `claude-sonnet-4-5`). Default (undefined):
|
|
2472
|
+
* strip when talking to `api.anthropic.com`, which rejects a prefixed id;
|
|
2473
|
+
* keep for a gateway or proxy, which usually routes on it. An explicit value
|
|
2474
|
+
* always wins.
|
|
2475
|
+
*/
|
|
2476
|
+
stripProviderPrefix?: boolean;
|
|
2451
2477
|
/** Wire version pinned in the `anthropic-version` header. */
|
|
2452
2478
|
apiVersion?: string;
|
|
2453
2479
|
/** Extra headers (e.g. for a gateway). */
|
|
@@ -2512,6 +2538,8 @@ declare class AnthropicProvider implements Provider {
|
|
|
2512
2538
|
private readonly opts;
|
|
2513
2539
|
private readonly fetchImpl;
|
|
2514
2540
|
constructor(opts?: AnthropicOptions);
|
|
2541
|
+
/** The id Anthropic's API sees: bare at `api.anthropic.com`, as written elsewhere. */
|
|
2542
|
+
private modeloEnElCable;
|
|
2515
2543
|
generate(req: ProviderRequest): Promise<ProviderResponse>;
|
|
2516
2544
|
private construirCuerpo;
|
|
2517
2545
|
private marcarCache;
|
|
@@ -3447,4 +3475,4 @@ interface SavingsLayer {
|
|
|
3447
3475
|
*/
|
|
3448
3476
|
declare function createSavingsLayer(config: Omit<SavingsLayerConfig, "tokenizer"> & Partial<Pick<SavingsLayerConfig, "tokenizer">>): SavingsLayer;
|
|
3449
3477
|
|
|
3450
|
-
export { type AnthropicOptions, AnthropicProvider, BV_SALA_VERSION, type BivelioHandoff, CATALOGO, COMPACT_ROWS_INSTRUCTION, type CacheOutcome, type CacheTier, type CachedAnswer, type CanonicalRequest, type ChatMessage, type CompactRowsDecodeOptions, type CompactRowsOptions, type CompactVerification, type CompressionEconomics, type CompressionPolicyInput, type CompressionRequest, type CompressionResult, type Compressor, type ConstraintBackend, type ConstraintBackendId, type ConstraintPlan, type ConversationState, type CostBasis, type CostModel, DEFAULT_COST_MODEL, DEFAULT_MAX_STALENESS_SECONDS, type DeferredExecutionReport, type DeterministicResolver, EMBEDDED_PUBLIC_KEY, type EmbeddingFn, type EvidenceDoc, type ExactCache, ExactTokenizer, type ExecutionClass, ExecutionRouter, type FormatChoice, FormatSelector, type FormatSelectorOptions, type HandoffFact, HeuristicEstimator, InMemoryExactCache, InMemorySemanticCache, InMemoryToolSetFreezer, type JsonSchema, LicenseError, type LicenseGate, type LicenseKeyShape, type LicenseKeyset, type LicenseStatus, type LicenseTokenPayload, type LocalClassifier, MODELOS_POR_CODIFICACION, MODELS_BY_ENCODING, type MemoryDelta, type MessageRole, MockProvider, type MockProviderOptions, type ModelCascadeMode, type ModelCascadeReport, type ModelCascadeSettings, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OutputContract, PRECIOS_AL_DIA, type Policy, type ProtectedSpan, type Provider, type ProviderRequest, type ProviderResponse, type ProviderUsage, QUALITY_STATUSES, type QualityStatus, type RequestContext, type Reranker, type ResolvedDeps, type ResolvedGate, type ResolvedLicense, ResolverRegistry, type ResolverResult, type RetrievalOptions, type RetrievalOutcome, type RetrievalPlan, type Retriever, type RevocationListBody, type RevocationListVerification, type RevocationPollEvent, RevocationPoller, type RevocationPollerOptions, RevocationSnapshot, type RouteDecision, type SavingsLayer, type SavingsLayerConfig, SavingsLedger, type SavingsReport, type SavingsRequest, type SavingsResult, type SavingsToggles, SchemaRegistry, type SemanticCacheOptions, type SemanticHit, type SemanticRecord, type SemanticVerifier, type SerializationFormat, type Serializer, Singleflight, type TokenEstimator, TokenizerRegistry, type ToolCallRequest, type ToolDescriptor, type ToolRisk, type ToolSelection, ToolSelector, type ToolSelectorOptions, type ToolSetFreezer, TraceCollector, type TraceEvent, UMBRAL_LOCAL, UsageEmitter, type UsageEmitterOptions, type ValidationError, type ValidationResult, adaptiveK, arithmeticResolver, buildExactKey, buildInflightKey, canonicalize, compactRowsSerializer, compresionFiel, computeNextDelay, cosine, createCompactRowsSerializer, createDefaultResolvers, createHandoff, createMockProvider, createSavingsLayer, csvSerializer, decodeCompactRows, dedupe, defaultTokenizerRegistry, deriveSeatId, deriveStatus, detectCi, embebedorLocal, emptyState, encodeCompactRows, evalArithmetic, evaluatePolicy, executeRetrievalPlan, gateFromKey, heuristicEstimator, isKeyset, isStrictCompatible, jsonCompactSerializer, keyTokensMatch, licenseKeyShape, liveGateFromKey, mergeDelta, modelFamilyOf, multisetEqual, negationCount, noopCompressor, normalizeLicenseKey, normalizeText, numericTokens, precioDeLista, projectContext, providerNativeBackend, randomId, registerExactTokenizer, registrarTokenizadorExacto, renderState, resolveConstraintBackend, resolveDependencies, resolveLicense, sha256, shouldCompress, stableStringify, uniformColumns, validateAgainstSchema, vectorLocal, verifyCompactSignature, verifyLicenseToken, verifyRevocationList, withProtectedSpans, words };
|
|
3478
|
+
export { type AnthropicOptions, AnthropicProvider, BV_SALA_VERSION, type BivelioHandoff, CATALOGO, COMPACT_ROWS_INSTRUCTION, type CacheOutcome, type CacheTier, type CachedAnswer, type CanonicalRequest, type ChatMessage, type CompactRowsDecodeOptions, type CompactRowsOptions, type CompactVerification, type CompressionEconomics, type CompressionPolicyInput, type CompressionRequest, type CompressionResult, type Compressor, type ConstraintBackend, type ConstraintBackendId, type ConstraintPlan, type ConversationState, type CostBasis, type CostModel, DEFAULT_COST_MODEL, DEFAULT_MAX_STALENESS_SECONDS, type DeferredExecutionReport, type DeterministicResolver, EMBEDDED_PUBLIC_KEY, type EmbeddingFn, type EvidenceDoc, type ExactCache, ExactTokenizer, type ExecutionClass, ExecutionRouter, type FormatChoice, FormatSelector, type FormatSelectorOptions, type HandoffFact, HeuristicEstimator, InMemoryExactCache, InMemorySemanticCache, InMemoryToolSetFreezer, type JsonSchema, LicenseError, type LicenseGate, type LicenseKeyShape, type LicenseKeyset, type LicenseStatus, type LicenseTokenPayload, type LocalClassifier, MODELOS_POR_CODIFICACION, MODELS_BY_ENCODING, type MemoryDelta, type MessageRole, MockProvider, type MockProviderOptions, type ModelCascadeMode, type ModelCascadeReport, type ModelCascadeSettings, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OutputContract, PRECIOS_AL_DIA, type Policy, type ProtectedSpan, type Provider, type ProviderRequest, type ProviderResponse, type ProviderUsage, QUALITY_STATUSES, type QualityStatus, type RequestContext, type Reranker, type ResolvedDeps, type ResolvedGate, type ResolvedLicense, ResolverRegistry, type ResolverResult, type RetrievalOptions, type RetrievalOutcome, type RetrievalPlan, type Retriever, type RevocationListBody, type RevocationListVerification, type RevocationPollEvent, RevocationPoller, type RevocationPollerOptions, RevocationSnapshot, type RouteDecision, type SavingsLayer, type SavingsLayerConfig, SavingsLedger, type SavingsReport, type SavingsRequest, type SavingsResult, type SavingsToggles, SchemaRegistry, type SemanticCacheOptions, type SemanticHit, type SemanticRecord, type SemanticVerifier, type SerializationFormat, type Serializer, Singleflight, type TokenEstimator, TokenizerRegistry, type ToolCallRequest, type ToolDescriptor, type ToolRisk, type ToolSelection, ToolSelector, type ToolSelectorOptions, type ToolSetFreezer, TraceCollector, type TraceEvent, UMBRAL_LOCAL, UsageEmitter, type UsageEmitterOptions, type ValidationError, type ValidationResult, adaptiveK, arithmeticResolver, buildExactKey, buildInflightKey, canonicalize, compactRowsSerializer, compresionFiel, computeNextDelay, cosine, createCompactRowsSerializer, createDefaultResolvers, createHandoff, createMockProvider, createSavingsLayer, csvSerializer, decodeCompactRows, dedupe, defaultTokenizerRegistry, deriveSeatId, deriveStatus, detectCi, embebedorLocal, emptyState, encodeCompactRows, evalArithmetic, evaluatePolicy, executeRetrievalPlan, gateFromKey, heuristicEstimator, isKeyset, isStrictCompatible, jsonCompactSerializer, keyTokensMatch, licenseKeyShape, liveGateFromKey, mergeDelta, modelFamilyOf, multisetEqual, negationCount, noopCompressor, normalizeLicenseKey, normalizeText, numericTokens, precioDeLista, projectContext, providerNativeBackend, quitarPrefijoDeProveedor, randomId, registerExactTokenizer, registrarTokenizadorExacto, renderState, resolveConstraintBackend, resolveDependencies, resolveLicense, sha256, shouldCompress, stableStringify, uniformColumns, validateAgainstSchema, vectorLocal, verifyCompactSignature, verifyLicenseToken, verifyRevocationList, withProtectedSpans, words };
|