vern-llm 2.6.2 → 2.8.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 +0 -2
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -78
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +231 -78
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -147,7 +147,7 @@ interface LLMErrorOptions {
|
|
|
147
147
|
/** Every attempt made before this error was thrown, in order. Absent when nothing was retried. */
|
|
148
148
|
attempts?: RetryAttempt[];
|
|
149
149
|
}
|
|
150
|
-
declare class LLMError extends Error {
|
|
150
|
+
export declare class LLMError extends Error {
|
|
151
151
|
type: LLMErrorType;
|
|
152
152
|
status?: number;
|
|
153
153
|
issues?: unknown;
|
|
@@ -203,7 +203,7 @@ declare class LLMError extends Error {
|
|
|
203
203
|
*/
|
|
204
204
|
toJSON(): Record<string, unknown>;
|
|
205
205
|
}
|
|
206
|
-
declare function isLLMError(err: unknown): err is LLMError;
|
|
206
|
+
export declare function isLLMError(err: unknown): err is LLMError;
|
|
207
207
|
/**
|
|
208
208
|
* Narrows `err.issues` to the exact shape {@link LLMErrorIssuesByCode} maps
|
|
209
209
|
* `code` to, for any code listed there. `code` stays the only discriminator
|
|
@@ -216,7 +216,7 @@ declare function isLLMError(err: unknown): err is LLMError;
|
|
|
216
216
|
* }
|
|
217
217
|
* ```
|
|
218
218
|
*/
|
|
219
|
-
declare function hasIssues<C extends keyof LLMErrorIssuesByCode>(err: LLMError, code: C): err is LLMError & {
|
|
219
|
+
export declare function hasIssues<C extends keyof LLMErrorIssuesByCode>(err: LLMError, code: C): err is LLMError & {
|
|
220
220
|
code: C;
|
|
221
221
|
issues: LLMErrorIssuesByCode[C];
|
|
222
222
|
};
|
|
@@ -241,7 +241,7 @@ type EvictionOption = 'fifo' | 'lru';
|
|
|
241
241
|
* Trivial default so the package works out of the box with no external deps.
|
|
242
242
|
* Not shared across processes, swap in Redis/Upstash/etc for production.
|
|
243
243
|
*/
|
|
244
|
-
declare class InMemoryCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
244
|
+
export declare class InMemoryCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
245
245
|
private readonly maxSize;
|
|
246
246
|
private store;
|
|
247
247
|
private readonly eviction;
|
|
@@ -258,7 +258,7 @@ declare class InMemoryCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
|
258
258
|
/**
|
|
259
259
|
* Normalizes keys before caching to avoid duplicate entries from formatting differences.
|
|
260
260
|
*/
|
|
261
|
-
declare class NormalizedCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
261
|
+
export declare class NormalizedCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
262
262
|
private readonly inner;
|
|
263
263
|
constructor(inner?: CacheAdapter<T>);
|
|
264
264
|
private normalize;
|
|
@@ -274,7 +274,7 @@ declare class NormalizedCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
|
274
274
|
* Two-tier cache with fast local L1 and shared L2.
|
|
275
275
|
* L2 hits are promoted back to L1.
|
|
276
276
|
*/
|
|
277
|
-
declare class TieredCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
277
|
+
export declare class TieredCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
278
278
|
private readonly l1;
|
|
279
279
|
private readonly l2;
|
|
280
280
|
private readonly l1Ttl?;
|
|
@@ -372,6 +372,19 @@ interface MiddlewareCapabilities {
|
|
|
372
372
|
*/
|
|
373
373
|
supportsJsonObjectMode: boolean;
|
|
374
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Not exported. Distinguishes `MiddlewareStateKey<T>` from
|
|
377
|
+
* `MiddlewareRef` and from a plain `{ debugName }` object literal at
|
|
378
|
+
* the type level, even though all three have the identical runtime
|
|
379
|
+
* shape. Without this, `MiddlewareStateKey<T>`/`MiddlewareRef` are
|
|
380
|
+
* structurally just `{ debugName: string }`, so TypeScript would treat
|
|
381
|
+
* a state key as a valid middleware ref (or vice versa), and would let
|
|
382
|
+
* anyone hand-write `{ debugName: 'auth' }` in place of a real
|
|
383
|
+
* `createMiddlewareRef` result. Neither is possible once this brand is
|
|
384
|
+
* required: only `createStateKey`, which alone has access to this
|
|
385
|
+
* symbol, can produce a value satisfying `MiddlewareStateKey<T>`.
|
|
386
|
+
*/
|
|
387
|
+
declare const stateKeyBrand: unique symbol;
|
|
375
388
|
/**
|
|
376
389
|
* A typed reference to one slot in `ctx.state`. Create one with
|
|
377
390
|
* `createStateKey`, export it, and import the same reference wherever
|
|
@@ -382,6 +395,7 @@ interface MiddlewareCapabilities {
|
|
|
382
395
|
*/
|
|
383
396
|
interface MiddlewareStateKey<T> {
|
|
384
397
|
readonly debugName: string;
|
|
398
|
+
readonly [stateKeyBrand]: true;
|
|
385
399
|
/**
|
|
386
400
|
* Never set at runtime; exists purely so `T` is actually used
|
|
387
401
|
* somewhere in this interface's shape (a phantom type), which is what
|
|
@@ -392,7 +406,43 @@ interface MiddlewareStateKey<T> {
|
|
|
392
406
|
readonly __phantom?: T;
|
|
393
407
|
}
|
|
394
408
|
/** Creates a new, distinct `MiddlewareStateKey`. `debugName` is used only in log lines and the `'middleware'` event; it never affects equality. */
|
|
395
|
-
declare function createStateKey<T>(debugName: string): MiddlewareStateKey<T>;
|
|
409
|
+
export declare function createStateKey<T>(debugName: string): MiddlewareStateKey<T>;
|
|
410
|
+
/** Not exported. See `stateKeyBrand`; same reasoning, distinct symbol, so the two token types can't be cross-assigned either. */
|
|
411
|
+
declare const middlewareRefBrand: unique symbol;
|
|
412
|
+
/**
|
|
413
|
+
* A typed reference to one middleware's identity, for `runsAfter`/
|
|
414
|
+
* `runsBefore` to target. Purely an ordering concern: unlike `name`,
|
|
415
|
+
* `ref` is never used as a display label anywhere (`name` still covers
|
|
416
|
+
* that), only as a `runsAfter`/`runsBefore` match target. Create one
|
|
417
|
+
* with `createMiddlewareRef`, export it from the package that owns the
|
|
418
|
+
* middleware, and have any dependent import the same reference instead
|
|
419
|
+
* of typing a matching `name` string. Same reasoning as
|
|
420
|
+
* `MiddlewareStateKey`: a typo becomes a missing import, a compile
|
|
421
|
+
* error, instead of a silently unresolved (or worse, silently
|
|
422
|
+
* colliding) string.
|
|
423
|
+
*/
|
|
424
|
+
interface MiddlewareRef {
|
|
425
|
+
readonly debugName: string;
|
|
426
|
+
readonly [middlewareRefBrand]: true;
|
|
427
|
+
}
|
|
428
|
+
/** Creates a new, distinct `MiddlewareRef`. `debugName` is used only in error messages when a reference doesn't resolve; it never affects equality, so two refs with the same `debugName` never collide. */
|
|
429
|
+
export declare function createMiddlewareRef(debugName: string): MiddlewareRef;
|
|
430
|
+
/**
|
|
431
|
+
* A `runsAfter`/`runsBefore` entry that escalates an unresolved
|
|
432
|
+
* reference from a warning to a construction-time throw. Wrap a
|
|
433
|
+
* `MiddlewareRef` with `requireRef` when the dependency isn't optional:
|
|
434
|
+
* a bare `MiddlewareRef` in `runsAfter`/`runsBefore` means "order
|
|
435
|
+
* relative to this if it's registered," which is the right default for
|
|
436
|
+
* a dependency a third party may reasonably not have installed. A
|
|
437
|
+
* `RequiredMiddlewareRef` means "this middleware must not run without
|
|
438
|
+
* that dependency having already run". The app should fail to start
|
|
439
|
+
* rather than run with a silently-missing ordering guarantee.
|
|
440
|
+
*/
|
|
441
|
+
interface RequiredMiddlewareRef {
|
|
442
|
+
readonly ref: MiddlewareRef;
|
|
443
|
+
}
|
|
444
|
+
/** Wraps `ref` so `runsAfter`/`runsBefore` throws at `VernLLM` construction time if it doesn't resolve, instead of warning and continuing. */
|
|
445
|
+
export declare function requireRef(ref: MiddlewareRef): RequiredMiddlewareRef;
|
|
396
446
|
/**
|
|
397
447
|
* Typed, per-logical-call storage two middleware can deliberately share a
|
|
398
448
|
* value through (a span ID one sets, another reads). Backed by a plain
|
|
@@ -404,7 +454,7 @@ interface MiddlewareStateBag {
|
|
|
404
454
|
set<T>(key: MiddlewareStateKey<T>, value: T): void;
|
|
405
455
|
}
|
|
406
456
|
/** A plain, `Map`-backed `MiddlewareStateBag`. */
|
|
407
|
-
declare function createMiddlewareStateBag(): MiddlewareStateBag;
|
|
457
|
+
export declare function createMiddlewareStateBag(): MiddlewareStateBag;
|
|
408
458
|
/** Fields every `MiddlewareContext` variant carries, regardless of `stage`. */
|
|
409
459
|
interface MiddlewareContextBase {
|
|
410
460
|
requestId: string;
|
|
@@ -415,6 +465,14 @@ interface MiddlewareContextBase {
|
|
|
415
465
|
state: MiddlewareStateBag;
|
|
416
466
|
/** Simple, string-keyed scratch space, pre-namespaced to this one middleware so two middleware can never collide here even by accident. */
|
|
417
467
|
own: Record<string, unknown>;
|
|
468
|
+
/**
|
|
469
|
+
* Every registered middleware's resolved label, in `transformOrder`,
|
|
470
|
+
* frozen. Lets a middleware make an informed call, like skipping a
|
|
471
|
+
* duplicate action when it detects another known middleware by name
|
|
472
|
+
* already handles it, without needing to know anything else about
|
|
473
|
+
* that middleware's own configuration.
|
|
474
|
+
*/
|
|
475
|
+
registeredMiddlewareNames: readonly string[];
|
|
418
476
|
}
|
|
419
477
|
/**
|
|
420
478
|
* The `ctx` `transform` receives, and every attempt-scoped event context
|
|
@@ -546,8 +604,45 @@ interface CallResult<T = unknown> {
|
|
|
546
604
|
interface VernLLMMiddleware {
|
|
547
605
|
/** Used in log lines and the `'middleware'` event. Defaults to this entry's array position when omitted. */
|
|
548
606
|
name?: string;
|
|
607
|
+
/**
|
|
608
|
+
* This entry's own identity, purely for another middleware's
|
|
609
|
+
* `runsAfter`/`runsBefore` to target. Create with `createMiddlewareRef`,
|
|
610
|
+
* export it, and have a dependent import the same reference. Optional:
|
|
611
|
+
* only needed if something else must be able to depend on this
|
|
612
|
+
* specific entry. Unrelated to `name`: `ref` is never shown in logs,
|
|
613
|
+
* `name` is never matched against for ordering.
|
|
614
|
+
*/
|
|
615
|
+
ref?: MiddlewareRef;
|
|
549
616
|
/** Sort key for composition order, ascending, ties broken by array order. See the middleware docs for what "lower runs first" means for `wrap`. */
|
|
550
617
|
priority?: number;
|
|
618
|
+
/**
|
|
619
|
+
* Other middleware this entry must run after, breaking ties
|
|
620
|
+
* `priority` alone can't express. Matched by `ref` identity, so a
|
|
621
|
+
* typo or a stale copy simply fails to resolve instead of silently
|
|
622
|
+
* matching the wrong entry. A bare `MiddlewareRef` that doesn't
|
|
623
|
+
* resolve is dropped, not an error, since a third party may
|
|
624
|
+
* reasonably reference a well known middleware that isn't installed
|
|
625
|
+
* everywhere; wrap it with `requireRef` to make that same target
|
|
626
|
+
* mandatory instead, throwing at `VernLLM` construction time if it's
|
|
627
|
+
* missing. A cycle across `runsAfter`/`runsBefore` always throws,
|
|
628
|
+
* regardless of whether any individual entry is required.
|
|
629
|
+
*/
|
|
630
|
+
runsAfter?: (MiddlewareRef | RequiredMiddlewareRef)[];
|
|
631
|
+
/**
|
|
632
|
+
* Other middleware this entry must run before. See `runsAfter`; a
|
|
633
|
+
* bare reference is dropped if unresolved, a `requireRef`-wrapped one
|
|
634
|
+
* throws.
|
|
635
|
+
*/
|
|
636
|
+
runsBefore?: (MiddlewareRef | RequiredMiddlewareRef)[];
|
|
637
|
+
/**
|
|
638
|
+
* Pins this entry's slot in `wrap` nesting only, independent of
|
|
639
|
+
* `priority`/`runsAfter`/`runsBefore`, which still govern
|
|
640
|
+
* `transform`/`onEvent` order. `'outermost'` sees the net
|
|
641
|
+
* `CallResult` of every retry, fallback, and other middleware's
|
|
642
|
+
* `wrap`; `'innermost'` sits closest to the real dispatch. A numeric
|
|
643
|
+
* value behaves like `priority`, but only for `wrap` nesting.
|
|
644
|
+
*/
|
|
645
|
+
position?: 'outermost' | 'innermost' | number;
|
|
551
646
|
/**
|
|
552
647
|
* Boolean for a static on/off switch, or a predicate evaluated per
|
|
553
648
|
* call. A throwing, rejecting, or timed-out predicate is logged and
|
|
@@ -650,7 +745,7 @@ interface TrippingPolicy {
|
|
|
650
745
|
*/
|
|
651
746
|
forget?(key: string): void;
|
|
652
747
|
}
|
|
653
|
-
declare class ConsecutiveTripping implements TrippingPolicy {
|
|
748
|
+
export declare class ConsecutiveTripping implements TrippingPolicy {
|
|
654
749
|
private readonly threshold;
|
|
655
750
|
private failuresByKey;
|
|
656
751
|
constructor(threshold: number);
|
|
@@ -659,7 +754,7 @@ declare class ConsecutiveTripping implements TrippingPolicy {
|
|
|
659
754
|
reset(key: string): void;
|
|
660
755
|
forget(key: string): void;
|
|
661
756
|
}
|
|
662
|
-
declare class RollingTripping implements TrippingPolicy {
|
|
757
|
+
export declare class RollingTripping implements TrippingPolicy {
|
|
663
758
|
private readonly windowMs;
|
|
664
759
|
private readonly minCalls;
|
|
665
760
|
private readonly failureRatio;
|
|
@@ -687,7 +782,7 @@ type CircuitState = 'closed' | 'open' | 'half-open';
|
|
|
687
782
|
* across calls. Once the threshold is hit, short-circuits new calls with
|
|
688
783
|
* LLMError('circuit_open') until the cooldown elapses and a trial succeeds.
|
|
689
784
|
*/
|
|
690
|
-
declare class CircuitBreaker {
|
|
785
|
+
export declare class CircuitBreaker {
|
|
691
786
|
private readonly cooldownMs;
|
|
692
787
|
private readonly onStateChange?;
|
|
693
788
|
/** Whether this breaker tracks failures per model instead of one shared circuit. */
|
|
@@ -770,7 +865,7 @@ interface RetryBudgetOptions {
|
|
|
770
865
|
* the same primitive `RollingTripping` is built on, rather than a second
|
|
771
866
|
* hand rolled window.
|
|
772
867
|
*/
|
|
773
|
-
declare class RetryBudget {
|
|
868
|
+
export declare class RetryBudget {
|
|
774
869
|
private readonly options;
|
|
775
870
|
private readonly ratio;
|
|
776
871
|
constructor(options: RetryBudgetOptions);
|
|
@@ -826,6 +921,16 @@ interface RateLimitOptions {
|
|
|
826
921
|
* chars/4 heuristic over message content plus `max_tokens`.
|
|
827
922
|
*/
|
|
828
923
|
estimateTokens?: (request: WireRequest) => number;
|
|
924
|
+
/**
|
|
925
|
+
* Scales the pre-flight estimate down before it's reserved against
|
|
926
|
+
* `tokensPerMinute`, since most calls don't use their full `max_tokens`
|
|
927
|
+
* budget. Applied after `estimateTokens`, as rate-limiter bookkeeping
|
|
928
|
+
* only; never changes the `max_tokens` sent to the provider.
|
|
929
|
+
* `release`'s `actualTokens` still reconciles against real usage
|
|
930
|
+
* afterward. Default `1` (today's behavior, no scaling). Must be a
|
|
931
|
+
* finite number greater than `0`; values above `1` are clamped to `1`.
|
|
932
|
+
*/
|
|
933
|
+
estimateFraction?: number;
|
|
829
934
|
/**
|
|
830
935
|
* AIMD against the `requestsPerMinute` bucket. Omit for a fixed
|
|
831
936
|
* ceiling, today's behavior. Requires `requestsPerMinute`.
|
|
@@ -835,7 +940,7 @@ interface RateLimitOptions {
|
|
|
835
940
|
interface AimdOptions {
|
|
836
941
|
/** Added to the requests-per-minute ceiling on every clean release. */
|
|
837
942
|
increaseBy: number;
|
|
838
|
-
/** Multiplied against the ceiling on a rate-limit signal. Must be
|
|
943
|
+
/** Multiplied against the ceiling on a rate-limit signal. Must be greater than `0` and at most `1`; clamped otherwise. */
|
|
839
944
|
decreaseFactor: number;
|
|
840
945
|
/** Floor the ceiling never shrinks below. */
|
|
841
946
|
minCapacity: number;
|
|
@@ -848,6 +953,14 @@ interface AimdOptions {
|
|
|
848
953
|
*/
|
|
849
954
|
proactiveFloor?: number;
|
|
850
955
|
}
|
|
956
|
+
interface RateLimitState {
|
|
957
|
+
/** Requests still available this window, or `undefined` if `requestsPerMinute` isn't configured. */
|
|
958
|
+
requestsRemaining?: number;
|
|
959
|
+
/** Tokens still available this window, or `undefined` if `tokensPerMinute` isn't configured. */
|
|
960
|
+
tokensRemaining?: number;
|
|
961
|
+
/** Concurrency slots currently in use, or `undefined` if `maxConcurrent` isn't configured. */
|
|
962
|
+
concurrentInFlight?: number;
|
|
963
|
+
}
|
|
851
964
|
interface RateLimitAcquireResult {
|
|
852
965
|
/**
|
|
853
966
|
* Releases the concurrency slot this attempt held and reconciles the
|
|
@@ -862,7 +975,7 @@ interface RateLimitAcquireResult {
|
|
|
862
975
|
reason?: RateLimitReason;
|
|
863
976
|
}
|
|
864
977
|
/** Default `estimateTokens`: chars/4 over every message's content, plus the requested `max_tokens`. */
|
|
865
|
-
declare function defaultEstimateTokens(request: WireRequest): number;
|
|
978
|
+
export declare function defaultEstimateTokens(request: WireRequest): number;
|
|
866
979
|
/**
|
|
867
980
|
* What VernLLM's dispatch layer needs from a limiter. `RateLimiter`
|
|
868
981
|
* implements this; a caller wanting cross-process coordination can hand
|
|
@@ -875,6 +988,8 @@ interface RateLimiterAdapter {
|
|
|
875
988
|
acquire(estimatedTokens: number, signal?: AbortSignal): Promise<RateLimitAcquireResult>;
|
|
876
989
|
signalRateLimit(): void;
|
|
877
990
|
reactToRateLimitHint(hint: ProviderRateLimitHint | undefined): void;
|
|
991
|
+
/** Optional: current bucket levels, for introspection. Omit if the adapter has no state worth reporting. */
|
|
992
|
+
getState?(): RateLimitState;
|
|
878
993
|
}
|
|
879
994
|
/**
|
|
880
995
|
* Per-target rate limiter. Up to three buckets (requests/min, tokens/min,
|
|
@@ -882,7 +997,7 @@ interface RateLimiterAdapter {
|
|
|
882
997
|
* stream of small ones. Any bucket omitted from `options` has infinite
|
|
883
998
|
* capacity and never blocks.
|
|
884
999
|
*/
|
|
885
|
-
declare class RateLimiter implements RateLimiterAdapter {
|
|
1000
|
+
export declare class RateLimiter implements RateLimiterAdapter {
|
|
886
1001
|
private readonly requests?;
|
|
887
1002
|
private readonly tokens?;
|
|
888
1003
|
private readonly concurrency?;
|
|
@@ -891,6 +1006,7 @@ declare class RateLimiter implements RateLimiterAdapter {
|
|
|
891
1006
|
private readonly maxQueueMs;
|
|
892
1007
|
private readonly maxQueueSize;
|
|
893
1008
|
private readonly estimateTokensFn;
|
|
1009
|
+
private readonly estimateFraction;
|
|
894
1010
|
private readonly aimd?;
|
|
895
1011
|
private readonly queue;
|
|
896
1012
|
/**
|
|
@@ -902,7 +1018,13 @@ declare class RateLimiter implements RateLimiterAdapter {
|
|
|
902
1018
|
*/
|
|
903
1019
|
private wakeTimer?;
|
|
904
1020
|
constructor(options: RateLimitOptions);
|
|
905
|
-
/**
|
|
1021
|
+
/**
|
|
1022
|
+
* Pre-flight token estimate for a request, per the configured (or
|
|
1023
|
+
* default) heuristic, scaled by `estimateFraction`. This is the sole
|
|
1024
|
+
* value reserved against `tokensPerMinute` and later reconciled in
|
|
1025
|
+
* `release`; the provider-facing `max_tokens` on the request itself is
|
|
1026
|
+
* never touched.
|
|
1027
|
+
*/
|
|
906
1028
|
estimate(request: WireRequest): number;
|
|
907
1029
|
/**
|
|
908
1030
|
* Waits for capacity in every configured bucket, then takes from each.
|
|
@@ -953,6 +1075,12 @@ declare class RateLimiter implements RateLimiterAdapter {
|
|
|
953
1075
|
* `hint.remainingRequests` is at or below `aimd.proactiveFloor`.
|
|
954
1076
|
*/
|
|
955
1077
|
reactToRateLimitHint(hint: ProviderRateLimitHint | undefined): void;
|
|
1078
|
+
/**
|
|
1079
|
+
* Current bucket levels, read live rather than cached. `concurrency`
|
|
1080
|
+
* tracks free slots internally, so `concurrentInFlight` is reported as
|
|
1081
|
+
* `capacity - available`, the inverse of what the bucket itself holds.
|
|
1082
|
+
*/
|
|
1083
|
+
getState(): RateLimitState;
|
|
956
1084
|
}
|
|
957
1085
|
//#endregion
|
|
958
1086
|
//#region src/internal/utils/rateLimitAdapter.utils.d.ts
|
|
@@ -1057,7 +1185,7 @@ type FallbackOn = (error: LLMError, context: {
|
|
|
1057
1185
|
* The default `fallbackOn` policy. Exported so a caller can wrap rather
|
|
1058
1186
|
* than replace it, e.g. `fallbackOn: (e, ctx) => myCheck(e) ? 'stop' : defaultFallbackOn(e, ctx)`.
|
|
1059
1187
|
*/
|
|
1060
|
-
declare const defaultFallbackOn: FallbackOn;
|
|
1188
|
+
export declare const defaultFallbackOn: FallbackOn;
|
|
1061
1189
|
/**
|
|
1062
1190
|
* Thrown when the chain gives up, whether because the last target failed
|
|
1063
1191
|
* or `fallbackOn` chose to stop early. Carries each attempt in order so
|
|
@@ -1067,7 +1195,7 @@ declare const defaultFallbackOn: FallbackOn;
|
|
|
1067
1195
|
* so existing type-based handling, including reading `retryAfterMs` on an
|
|
1068
1196
|
* `'api'`-typed error, keeps working on a fallback-exhausted error too.
|
|
1069
1197
|
*/
|
|
1070
|
-
declare class FallbackExhaustedError extends LLMError {
|
|
1198
|
+
export declare class FallbackExhaustedError extends LLMError {
|
|
1071
1199
|
readonly attempts: FallbackAttempt[];
|
|
1072
1200
|
constructor(attempts: FallbackAttempt[]);
|
|
1073
1201
|
/**
|
|
@@ -1079,7 +1207,7 @@ declare class FallbackExhaustedError extends LLMError {
|
|
|
1079
1207
|
get retryable(): boolean;
|
|
1080
1208
|
}
|
|
1081
1209
|
/** Narrows `err` to {@link FallbackExhaustedError}, for direct access to its `attempts` (`provider`/`model` per failed target) without a manual `instanceof` check. */
|
|
1082
|
-
declare function isFallbackExhaustedError(err: unknown): err is FallbackExhaustedError;
|
|
1210
|
+
export declare function isFallbackExhaustedError(err: unknown): err is FallbackExhaustedError;
|
|
1083
1211
|
/**
|
|
1084
1212
|
* Creates an empty ref box to pass as `CallParams['meta']`, so a caller can
|
|
1085
1213
|
* read the `CallMeta` written by `call()` on the same line as the result
|
|
@@ -1090,7 +1218,7 @@ declare function isFallbackExhaustedError(err: unknown): err is FallbackExhauste
|
|
|
1090
1218
|
* const result = await vern.call({ userContent: '...', meta });
|
|
1091
1219
|
* meta.current?.provider;
|
|
1092
1220
|
*/
|
|
1093
|
-
declare function metaRef(): {
|
|
1221
|
+
export declare function metaRef(): {
|
|
1094
1222
|
current?: CallMeta;
|
|
1095
1223
|
};
|
|
1096
1224
|
//#endregion
|
|
@@ -1165,7 +1293,7 @@ interface ToolDefinition<Name extends string = string, Args = unknown> {
|
|
|
1165
1293
|
* in `defineTool()` preserves the literal `name` type without requiring
|
|
1166
1294
|
* `as const` at every call site.
|
|
1167
1295
|
*/
|
|
1168
|
-
declare function defineTool<const Name extends string, Args = unknown>(tool: ToolDefinition<Name, Args>): ToolDefinition<Name, Args>;
|
|
1296
|
+
export declare function defineTool<const Name extends string, Args = unknown>(tool: ToolDefinition<Name, Args>): ToolDefinition<Name, Args>;
|
|
1169
1297
|
/** Maps a single `ToolDefinition` to its matching `ToolCall` shape. */
|
|
1170
1298
|
type ToolCallFor<T> = T extends ToolDefinition<infer N, infer A> ? {
|
|
1171
1299
|
id: string;
|
|
@@ -1226,7 +1354,7 @@ type ResolvedTools<Tools, R> = [Tools] extends [never] ? ExtractTools<R> : Tools
|
|
|
1226
1354
|
*
|
|
1227
1355
|
* Pass `Tools` explicitly to override inference, e.g. `isToolCallResult<typeof tools>(result)`.
|
|
1228
1356
|
*/
|
|
1229
|
-
declare function isToolCallResult<Tools extends readonly ToolDefinition[] | undefined = never, R = unknown>(result: R): result is R & ToolCallResult<NonNullable<ResolvedTools<Tools, R>>>;
|
|
1357
|
+
export declare function isToolCallResult<Tools extends readonly ToolDefinition[] | undefined = never, R = unknown>(result: R): result is R & ToolCallResult<NonNullable<ResolvedTools<Tools, R>>>;
|
|
1230
1358
|
/** What the model should do about tools on a given call. */
|
|
1231
1359
|
type ToolChoice = 'auto' | 'none' | 'required' | {
|
|
1232
1360
|
name: string;
|
|
@@ -1637,6 +1765,13 @@ interface SoftFailureMeta {
|
|
|
1637
1765
|
isFallback: boolean;
|
|
1638
1766
|
/** 1-based, matching `CallMeta.attempts`. */
|
|
1639
1767
|
attempt: number;
|
|
1768
|
+
/**
|
|
1769
|
+
* Token usage for this attempt, if the provider reported it on this
|
|
1770
|
+
* response. `undefined` when the provider omitted usage, not when
|
|
1771
|
+
* usage was zero, so a cost check should treat a missing value as
|
|
1772
|
+
* unknown rather than as free.
|
|
1773
|
+
*/
|
|
1774
|
+
usage?: TokenUsage;
|
|
1640
1775
|
}
|
|
1641
1776
|
/**
|
|
1642
1777
|
* Inspects an otherwise-successful result and optionally reclassifies it
|
|
@@ -1711,7 +1846,7 @@ type ExtractStreamValue<R> = Extract<R, StreamCallResult<unknown>> extends Strea
|
|
|
1711
1846
|
* }
|
|
1712
1847
|
* ```
|
|
1713
1848
|
*/
|
|
1714
|
-
declare function isStreamResult<R = unknown>(result: R): result is R & StreamCallResult<ExtractStreamValue<R>>;
|
|
1849
|
+
export declare function isStreamResult<R = unknown>(result: R): result is R & StreamCallResult<ExtractStreamValue<R>>;
|
|
1715
1850
|
/**
|
|
1716
1851
|
* `StreamEnabledCallParams` with `jsonMode: false`. Selects the streaming
|
|
1717
1852
|
* `call()` overload whose `finalResult` resolves to a plain `string`.
|
|
@@ -2011,7 +2146,7 @@ interface Logger {
|
|
|
2011
2146
|
* Default logger. `debug` is gated by the `debug` option on VernLLM
|
|
2012
2147
|
* warn/error always fire since they indicate real problems (retries, cache failures)
|
|
2013
2148
|
*/
|
|
2014
|
-
declare class ConsoleLogger implements Logger {
|
|
2149
|
+
export declare class ConsoleLogger implements Logger {
|
|
2015
2150
|
private debugEnabled;
|
|
2016
2151
|
constructor(debugEnabled: boolean);
|
|
2017
2152
|
debug(message: string): void;
|
|
@@ -2124,8 +2259,11 @@ interface VernLLMOptions {
|
|
|
2124
2259
|
* for the final close), in which case this does fire.
|
|
2125
2260
|
*/
|
|
2126
2261
|
onUsageFailure?: OnUsageFailure;
|
|
2127
|
-
/**
|
|
2128
|
-
|
|
2262
|
+
/**
|
|
2263
|
+
* Injectable logger. Defaults to a console-based logger gated by `debug`.
|
|
2264
|
+
* Pass `'silent'` to discard all log output without stubbing a Logger.
|
|
2265
|
+
*/
|
|
2266
|
+
logger?: Logger | 'silent';
|
|
2129
2267
|
/**
|
|
2130
2268
|
* Enables a circuit breaker that short-circuits calls after repeated
|
|
2131
2269
|
* consecutive failures, instead of continuing to hammer a down provider
|
|
@@ -2229,7 +2367,7 @@ type CreateMiddlewareOptions = Omit<VernLLMMiddleware, 'wrap'> & {
|
|
|
2229
2367
|
* error afterward, so `onError` never changes what the call itself
|
|
2230
2368
|
* returns or throws, only what gets observed about it.
|
|
2231
2369
|
*/
|
|
2232
|
-
declare function createMiddleware(options: CreateMiddlewareOptions): VernLLMMiddleware;
|
|
2370
|
+
export declare function createMiddleware(options: CreateMiddlewareOptions): VernLLMMiddleware;
|
|
2233
2371
|
//#endregion
|
|
2234
2372
|
//#region src/vernLLM.d.ts
|
|
2235
2373
|
/**
|
|
@@ -2240,7 +2378,7 @@ declare function createMiddleware(options: CreateMiddlewareOptions): VernLLMMidd
|
|
|
2240
2378
|
* tracking, and an optional response cache. All configurable, all opt-in
|
|
2241
2379
|
* beyond sensible defaults.
|
|
2242
2380
|
*/
|
|
2243
|
-
declare class VernLLM {
|
|
2381
|
+
export declare class VernLLM {
|
|
2244
2382
|
private readonly logger;
|
|
2245
2383
|
/**
|
|
2246
2384
|
* One `CallExecutor` per provider target: index 0 is the primary,
|
|
@@ -2255,8 +2393,14 @@ declare class VernLLM {
|
|
|
2255
2393
|
private readonly reportEvent;
|
|
2256
2394
|
/** Owns cache reads/writes and in-flight coalescing for `cachedCall()`. Only calls back into `this.call()` as an opaque function. */
|
|
2257
2395
|
private readonly cacheOrchestrator;
|
|
2258
|
-
/**
|
|
2259
|
-
|
|
2396
|
+
/**
|
|
2397
|
+
* See `VernLLMOptions.middleware`. Every resolved view of composition
|
|
2398
|
+
* order, built once here at construction time by
|
|
2399
|
+
* `buildMiddlewarePipeline`. Nothing downstream computes order
|
|
2400
|
+
* itself; each consumer reads `transformOrder`, `wrapOrder`, or
|
|
2401
|
+
* `names`, whichever it actually needs.
|
|
2402
|
+
*/
|
|
2403
|
+
private readonly pipeline;
|
|
2260
2404
|
/** See `VernLLMOptions.middlewareTimeoutMs`. Bounds `transform` and a function `enabled`; `wrap` itself is never bounded by this. */
|
|
2261
2405
|
private readonly middlewareTimeoutMs;
|
|
2262
2406
|
/**
|
|
@@ -2391,6 +2535,15 @@ declare class VernLLM {
|
|
|
2391
2535
|
attempts: number;
|
|
2392
2536
|
retryRatio: number;
|
|
2393
2537
|
} | undefined;
|
|
2538
|
+
/**
|
|
2539
|
+
* @param target.index Which target to read. Defaults to the primary.
|
|
2540
|
+
* @returns This target's current rate limit levels, or `undefined` if
|
|
2541
|
+
* that target has no limiter configured. A limiter is target-scoped,
|
|
2542
|
+
* not model-scoped, so unlike `getFailureBreakdown` there's no
|
|
2543
|
+
* `target.model` to pass.
|
|
2544
|
+
* @throws {RangeError} If `target.index` names no target.
|
|
2545
|
+
*/
|
|
2546
|
+
getRateLimitState(target?: Pick<CircuitTarget, 'index'>): RateLimitState | undefined;
|
|
2394
2547
|
/**
|
|
2395
2548
|
* @param model Which model bucket to read, for targets that isolate by model.
|
|
2396
2549
|
* @returns Every target's state, in chain order.
|
|
@@ -2436,7 +2589,7 @@ declare class VernLLM {
|
|
|
2436
2589
|
* `T` isn't a parameter here; pin it via `llm.call<T>(params)` as usual.
|
|
2437
2590
|
* `defineCachedCallParams` is the `cachedCall()` counterpart.
|
|
2438
2591
|
*/
|
|
2439
|
-
declare function defineCallParams<P extends CallParams<unknown>>(params: P): P;
|
|
2592
|
+
export declare function defineCallParams<P extends CallParams<unknown>>(params: P): P;
|
|
2440
2593
|
/**
|
|
2441
2594
|
* The `cachedCall()` counterpart to `defineCallParams`: preserves the
|
|
2442
2595
|
* whole `{ cacheKey, ttl, call }` object, `call.tools` included, in one
|
|
@@ -2451,7 +2604,7 @@ declare function defineCallParams<P extends CallParams<unknown>>(params: P): P;
|
|
|
2451
2604
|
* const result = await llm.cachedCall(params);
|
|
2452
2605
|
* ```
|
|
2453
2606
|
*/
|
|
2454
|
-
declare function defineCachedCallParams<P extends CachedCallParams<unknown>>(params: P): P;
|
|
2607
|
+
export declare function defineCachedCallParams<P extends CachedCallParams<unknown>>(params: P): P;
|
|
2455
2608
|
//#endregion
|
|
2456
2609
|
//#region src/adapters/internal/sse.d.ts
|
|
2457
2610
|
/**
|
|
@@ -2481,14 +2634,14 @@ declare function defineCachedCallParams<P extends CachedCallParams<unknown>>(par
|
|
|
2481
2634
|
* Malformed JSON in a frame throws `LLMError('parse')`, consistent with
|
|
2482
2635
|
* how malformed JSON is handled elsewhere in VernLLM.
|
|
2483
2636
|
*/
|
|
2484
|
-
declare function parseSseStream(source: AsyncIterable<Uint8Array | string>): AsyncGenerator<unknown>;
|
|
2637
|
+
export declare function parseSseStream(source: AsyncIterable<Uint8Array | string>): AsyncGenerator<unknown>;
|
|
2485
2638
|
/**
|
|
2486
2639
|
* Sentinel yielded by `parseSseStream` for a comment-only frame (no
|
|
2487
2640
|
* `data:` payload), the mechanism providers use for SSE keep-alive
|
|
2488
2641
|
* pings. Exported so a consumer (e.g. `fromFetch`) can react to "still
|
|
2489
2642
|
* alive" separately from a genuinely empty frame (`NO_DATA`, kept internal).
|
|
2490
2643
|
*/
|
|
2491
|
-
declare const SSE_PING: unique symbol;
|
|
2644
|
+
export declare const SSE_PING: unique symbol;
|
|
2492
2645
|
//#endregion
|
|
2493
2646
|
//#region src/adapters/internal/imageFormat.d.ts
|
|
2494
2647
|
/**
|
|
@@ -2735,7 +2888,7 @@ interface AnthropicAdapterOptions {
|
|
|
2735
2888
|
* instead, which maps to a real constraint either way (native
|
|
2736
2889
|
* `output_config.format` or a forced tool call).
|
|
2737
2890
|
*/
|
|
2738
|
-
declare function fromAnthropic(anthropicClient: AnthropicClient, options?: AnthropicAdapterOptions): LLMClient;
|
|
2891
|
+
export declare function fromAnthropic(anthropicClient: AnthropicClient, options?: AnthropicAdapterOptions): LLMClient;
|
|
2739
2892
|
//#endregion
|
|
2740
2893
|
//#region src/adapters/gemini.d.ts
|
|
2741
2894
|
/**
|
|
@@ -2947,7 +3100,7 @@ interface GeminiAdapterOptions {
|
|
|
2947
3100
|
*/
|
|
2948
3101
|
thinkingLevelModels?: ModelCapabilityOverride;
|
|
2949
3102
|
}
|
|
2950
|
-
declare function fromGemini(client: GeminiClient, options?: GeminiAdapterOptions): LLMClient;
|
|
3103
|
+
export declare function fromGemini(client: GeminiClient, options?: GeminiAdapterOptions): LLMClient;
|
|
2951
3104
|
//#endregion
|
|
2952
3105
|
//#region src/adapters/bedrock.d.ts
|
|
2953
3106
|
/** Bedrock Converse's supported inline image formats. */
|
|
@@ -3306,7 +3459,7 @@ interface AwsSendClient {
|
|
|
3306
3459
|
* `finalizeResponse`'s `content` path exactly like the non-streaming
|
|
3307
3460
|
* `create` branch above unwraps it.
|
|
3308
3461
|
*/
|
|
3309
|
-
declare function fromBedrock(bedrockClient: BedrockConverseClient | AwsSendClient, options?: BedrockAdapterOptions): LLMClient;
|
|
3462
|
+
export declare function fromBedrock(bedrockClient: BedrockConverseClient | AwsSendClient, options?: BedrockAdapterOptions): LLMClient;
|
|
3310
3463
|
//#endregion
|
|
3311
3464
|
//#region src/adapters/fetch.d.ts
|
|
3312
3465
|
/** The chat-completion-shaped request VernLLM builds internally */
|
|
@@ -3468,7 +3621,7 @@ interface FetchAdapterConfig {
|
|
|
3468
3621
|
* `LLMError('validation')` instead of quietly using unrelated native
|
|
3469
3622
|
* `fetch`.
|
|
3470
3623
|
*/
|
|
3471
|
-
declare function fromFetch(config: FetchAdapterConfig): LLMClient;
|
|
3624
|
+
export declare function fromFetch(config: FetchAdapterConfig): LLMClient;
|
|
3472
3625
|
//#endregion
|
|
3473
3626
|
//#region src/adapters/openaiCompatible.d.ts
|
|
3474
3627
|
/**
|
|
@@ -3535,7 +3688,7 @@ interface OpenAICompatibleAdapterOptions {
|
|
|
3535
3688
|
*/
|
|
3536
3689
|
supportsWithResponse?: boolean;
|
|
3537
3690
|
}
|
|
3538
|
-
declare function fromOpenAICompatible(client: unknown, options?: OpenAICompatibleAdapterOptions): LLMClient;
|
|
3691
|
+
export declare function fromOpenAICompatible(client: unknown, options?: OpenAICompatibleAdapterOptions): LLMClient;
|
|
3539
3692
|
/**
|
|
3540
3693
|
* Named alias for the OpenAI SDK itself. A raw `new OpenAI(...)` instance
|
|
3541
3694
|
* structurally matches most of `LLMClient`, but newer `openai` SDK major
|
|
@@ -3553,9 +3706,9 @@ declare function fromOpenAICompatible(client: unknown, options?: OpenAICompatibl
|
|
|
3553
3706
|
* official `openai` package's client versus a fake or a test double.
|
|
3554
3707
|
* Pass `supportsWithResponse: true` once you've confirmed it.
|
|
3555
3708
|
*/
|
|
3556
|
-
declare const fromOpenAI: typeof fromOpenAICompatible;
|
|
3709
|
+
export declare const fromOpenAI: typeof fromOpenAICompatible;
|
|
3557
3710
|
/** Groqs SDK matches the OpenAI wire format */
|
|
3558
|
-
declare const fromGroq: typeof fromOpenAICompatible;
|
|
3711
|
+
export declare const fromGroq: typeof fromOpenAICompatible;
|
|
3559
3712
|
/**
|
|
3560
3713
|
* Mistrals `chat.completions`-shaped client (or their OpenAI-compat
|
|
3561
3714
|
* endpoint). Mistral supports `stream_options.include_usage` (added after
|
|
@@ -3563,88 +3716,88 @@ declare const fromGroq: typeof fromOpenAICompatible;
|
|
|
3563
3716
|
* Mistral's changelog and streaming docs), so this is a plain alias like
|
|
3564
3717
|
* the others, `supportsStreamUsage` defaults to `true`.
|
|
3565
3718
|
*/
|
|
3566
|
-
declare const fromMistral: typeof fromOpenAICompatible;
|
|
3719
|
+
export declare const fromMistral: typeof fromOpenAICompatible;
|
|
3567
3720
|
/** DeepSeeks API is OpenAI-compatible */
|
|
3568
|
-
declare const fromDeepSeek: typeof fromOpenAICompatible;
|
|
3721
|
+
export declare const fromDeepSeek: typeof fromOpenAICompatible;
|
|
3569
3722
|
/** Cerebras inference API is OpenAI-compatible */
|
|
3570
|
-
declare const fromCerebras: typeof fromOpenAICompatible;
|
|
3723
|
+
export declare const fromCerebras: typeof fromOpenAICompatible;
|
|
3571
3724
|
/** Together AIs API is OpenAI-compatible */
|
|
3572
|
-
declare const fromTogether: typeof fromOpenAICompatible;
|
|
3725
|
+
export declare const fromTogether: typeof fromOpenAICompatible;
|
|
3573
3726
|
/** Fireworks AIs API is OpenAI-compatible */
|
|
3574
|
-
declare const fromFireworks: typeof fromOpenAICompatible;
|
|
3727
|
+
export declare const fromFireworks: typeof fromOpenAICompatible;
|
|
3575
3728
|
/**
|
|
3576
3729
|
* Ollama exposes an OpenAI-compatible endpoint at `/v1/chat/completions`
|
|
3577
3730
|
* (as opposed to its native `/api/chat` format, which differs). Point an
|
|
3578
3731
|
* OpenAI SDK instances `baseURL` at your Ollama server and pass it here:
|
|
3579
3732
|
* this does not talk to Ollamas native API directly.
|
|
3580
3733
|
*/
|
|
3581
|
-
declare const fromOllama: typeof fromOpenAICompatible;
|
|
3734
|
+
export declare const fromOllama: typeof fromOpenAICompatible;
|
|
3582
3735
|
/** OpenRouter's API is OpenAI-compatible */
|
|
3583
|
-
declare const fromOpenRouter: typeof fromOpenAICompatible;
|
|
3736
|
+
export declare const fromOpenRouter: typeof fromOpenAICompatible;
|
|
3584
3737
|
/** Perplexity's API is OpenAI-compatible */
|
|
3585
|
-
declare const fromPerplexity: typeof fromOpenAICompatible;
|
|
3738
|
+
export declare const fromPerplexity: typeof fromOpenAICompatible;
|
|
3586
3739
|
/** DeepInfra's API is OpenAI-compatible */
|
|
3587
|
-
declare const fromDeepInfra: typeof fromOpenAICompatible;
|
|
3740
|
+
export declare const fromDeepInfra: typeof fromOpenAICompatible;
|
|
3588
3741
|
/** Novita's API is OpenAI-compatible */
|
|
3589
|
-
declare const fromNovita: typeof fromOpenAICompatible;
|
|
3742
|
+
export declare const fromNovita: typeof fromOpenAICompatible;
|
|
3590
3743
|
/** Hyperbolic's API is OpenAI-compatible */
|
|
3591
|
-
declare const fromHyperbolic: typeof fromOpenAICompatible;
|
|
3744
|
+
export declare const fromHyperbolic: typeof fromOpenAICompatible;
|
|
3592
3745
|
/** Moonshot's (Kimi) API is OpenAI-compatible */
|
|
3593
|
-
declare const fromMoonshot: typeof fromOpenAICompatible;
|
|
3746
|
+
export declare const fromMoonshot: typeof fromOpenAICompatible;
|
|
3594
3747
|
/** Zhipu's (GLM) API is OpenAI-compatible */
|
|
3595
|
-
declare const fromZhipu: typeof fromOpenAICompatible;
|
|
3748
|
+
export declare const fromZhipu: typeof fromOpenAICompatible;
|
|
3596
3749
|
/**
|
|
3597
3750
|
* LM Studio exposes an OpenAI-compatible endpoint at `/v1/chat/completions`.
|
|
3598
3751
|
* Point an OpenAI SDK instance's `baseURL` at your local LM Studio server.
|
|
3599
3752
|
*/
|
|
3600
|
-
declare const fromLMStudio: typeof fromOpenAICompatible;
|
|
3753
|
+
export declare const fromLMStudio: typeof fromOpenAICompatible;
|
|
3601
3754
|
/**
|
|
3602
3755
|
* vLLM's OpenAI-compatible server mode exposes `/v1/chat/completions`.
|
|
3603
3756
|
* Point an OpenAI SDK instance's `baseURL` at your vLLM server.
|
|
3604
3757
|
*/
|
|
3605
|
-
declare const fromVLLM: typeof fromOpenAICompatible;
|
|
3758
|
+
export declare const fromVLLM: typeof fromOpenAICompatible;
|
|
3606
3759
|
/** xAI's Grok API is OpenAI-compatible */
|
|
3607
|
-
declare const fromXAI: typeof fromOpenAICompatible;
|
|
3760
|
+
export declare const fromXAI: typeof fromOpenAICompatible;
|
|
3608
3761
|
/** NVIDIA NIM's hosted and self-hosted endpoints are OpenAI-compatible */
|
|
3609
|
-
declare const fromNvidiaNIM: typeof fromOpenAICompatible;
|
|
3762
|
+
export declare const fromNvidiaNIM: typeof fromOpenAICompatible;
|
|
3610
3763
|
/** Vercel AI Gateway is OpenAI-compatible */
|
|
3611
|
-
declare const fromVercelAIGateway: typeof fromOpenAICompatible;
|
|
3764
|
+
export declare const fromVercelAIGateway: typeof fromOpenAICompatible;
|
|
3612
3765
|
/** Cloudflare Workers AI exposes an OpenAI-compatible endpoint */
|
|
3613
|
-
declare const fromCloudflareWorkersAI: typeof fromOpenAICompatible;
|
|
3766
|
+
export declare const fromCloudflareWorkersAI: typeof fromOpenAICompatible;
|
|
3614
3767
|
/** Nebius AI Studio is OpenAI-compatible */
|
|
3615
|
-
declare const fromNebius: typeof fromOpenAICompatible;
|
|
3768
|
+
export declare const fromNebius: typeof fromOpenAICompatible;
|
|
3616
3769
|
/** SambaNova Cloud's API is OpenAI-compatible */
|
|
3617
|
-
declare const fromSambaNova: typeof fromOpenAICompatible;
|
|
3770
|
+
export declare const fromSambaNova: typeof fromOpenAICompatible;
|
|
3618
3771
|
/** Baseten's model hosting exposes an OpenAI-compatible endpoint */
|
|
3619
|
-
declare const fromBaseten: typeof fromOpenAICompatible;
|
|
3772
|
+
export declare const fromBaseten: typeof fromOpenAICompatible;
|
|
3620
3773
|
/** Featherless AI's API is OpenAI-compatible */
|
|
3621
|
-
declare const fromFeatherless: typeof fromOpenAICompatible;
|
|
3774
|
+
export declare const fromFeatherless: typeof fromOpenAICompatible;
|
|
3622
3775
|
/** Friendli AI's serving endpoint is OpenAI-compatible */
|
|
3623
|
-
declare const fromFriendli: typeof fromOpenAICompatible;
|
|
3776
|
+
export declare const fromFriendli: typeof fromOpenAICompatible;
|
|
3624
3777
|
/** SiliconFlow's API is OpenAI-compatible */
|
|
3625
|
-
declare const fromSiliconFlow: typeof fromOpenAICompatible;
|
|
3778
|
+
export declare const fromSiliconFlow: typeof fromOpenAICompatible;
|
|
3626
3779
|
/** Parasail's inference API is OpenAI-compatible */
|
|
3627
|
-
declare const fromParasail: typeof fromOpenAICompatible;
|
|
3780
|
+
export declare const fromParasail: typeof fromOpenAICompatible;
|
|
3628
3781
|
/** StepFun's API is OpenAI-compatible */
|
|
3629
|
-
declare const fromStepFun: typeof fromOpenAICompatible;
|
|
3782
|
+
export declare const fromStepFun: typeof fromOpenAICompatible;
|
|
3630
3783
|
/** MiniMax's API is OpenAI-compatible */
|
|
3631
|
-
declare const fromMiniMax: typeof fromOpenAICompatible;
|
|
3784
|
+
export declare const fromMiniMax: typeof fromOpenAICompatible;
|
|
3632
3785
|
/** Lambda Labs' Inference API is OpenAI-compatible */
|
|
3633
|
-
declare const fromLambdaLabs: typeof fromOpenAICompatible;
|
|
3786
|
+
export declare const fromLambdaLabs: typeof fromOpenAICompatible;
|
|
3634
3787
|
/** Snowflake Cortex's LLM endpoint is OpenAI-compatible */
|
|
3635
|
-
declare const fromSnowflakeCortex: typeof fromOpenAICompatible;
|
|
3788
|
+
export declare const fromSnowflakeCortex: typeof fromOpenAICompatible;
|
|
3636
3789
|
/** Anyscale Endpoints' API is OpenAI-compatible */
|
|
3637
|
-
declare const fromAnyscale: typeof fromOpenAICompatible;
|
|
3790
|
+
export declare const fromAnyscale: typeof fromOpenAICompatible;
|
|
3638
3791
|
/** Lepton AI's inference API is OpenAI-compatible */
|
|
3639
|
-
declare const fromLepton: typeof fromOpenAICompatible;
|
|
3792
|
+
export declare const fromLepton: typeof fromOpenAICompatible;
|
|
3640
3793
|
/** Inference.net's API is OpenAI-compatible */
|
|
3641
|
-
declare const fromInferenceNet: typeof fromOpenAICompatible;
|
|
3794
|
+
export declare const fromInferenceNet: typeof fromOpenAICompatible;
|
|
3642
3795
|
/** Infermatic's API is OpenAI-compatible */
|
|
3643
|
-
declare const fromInfermatic: typeof fromOpenAICompatible;
|
|
3796
|
+
export declare const fromInfermatic: typeof fromOpenAICompatible;
|
|
3644
3797
|
/** AtlasCloud's inference API is OpenAI-compatible */
|
|
3645
|
-
declare const fromAtlasCloud: typeof fromOpenAICompatible;
|
|
3798
|
+
export declare const fromAtlasCloud: typeof fromOpenAICompatible;
|
|
3646
3799
|
/** 01.AI's (Yi models) API is OpenAI-compatible */
|
|
3647
|
-
declare const from01AI: typeof fromOpenAICompatible;
|
|
3800
|
+
export declare const from01AI: typeof fromOpenAICompatible;
|
|
3648
3801
|
//#endregion
|
|
3649
|
-
export {
|
|
3802
|
+
export type { AnthropicClient, AssistantContent, AttemptContext, BedrockConverseClient, CacheAdapter, CachedCallParams, CachedConditionalToolCallParams, CachedJsonModeDisabledCallParams, CachedJsonModeEnabledCallParams, CachedStreamCallParams, CachedStreamConditionalToolCallParams, CachedStreamJsonModeDisabledCallParams, CachedStreamJsonModeEnabledCallParams, CachedStreamToolCallParams, CachedToolCallParams, CallMeta, CallParams, CallResult, CallWithToolsResult, CircuitBreakerOptions, CircuitState, CircuitTarget, ConditionalToolCallParams, ContentBlock, ContentResult, ConversationTurn, CooldownBackoff, CreateMiddlewareOptions, DuplicateToolNamesIssue, EvictionOption, ExponentialBackoffOptions, FallbackAttempt, FallbackOn, FallbackTarget, FetchAdapterConfig, GeminiClient, HistoryToolResultIssue, ImageBlock, JsonModeDisabledCallParams, JsonModeEnabledCallParams, JsonSchemaSpec, JsonValue, LLMClient, LLMErrorCode, LLMErrorIssuesByCode, LLMErrorSnapshot, LLMErrorType, LLMRequestShape, LLMRequestSnapshot, Logger, MiddlewareCapabilities, MiddlewareContext, MiddlewareContextBase, MiddlewareRef, MiddlewareStateBag, MiddlewareStateKey, OnEvent, OnUsage, PreDispatchContext, RateLimitAcquireResult, RateLimitOptions, RateLimitReason, RateLimitState, RateLimiterAdapter, RefundUsage, RequiredMiddlewareRef, ReserveUsage, RetryAttempt, RetryBudgetOptions, SchemaLike, StreamCallResult, StreamChunk, StreamEnabledCallParams, StreamJsonModeDisabledCallParams, StreamJsonModeEnabledCallParams, TargetCircuitState, TextBlock, TokenUsage, ToolCall, ToolCallResult, ToolChoice, ToolDefinition, ToolEnabledCallParams, ToolIssue, ToolResult, ToolsDisabledCallParams, TrippingPolicy, UnknownToolChoiceIssue, UnsupportedCapabilityIssue, VernLLMEvent, VernLLMMiddleware, VernLLMOptions, WireCallRequest, WireCallRequestPatch, WireMessage, WireRequest, WireResponseFormat, WireStreamChunk, WireTool, WireToolCall, WireToolChoice };
|
|
3650
3803
|
//# sourceMappingURL=index.d.mts.map
|