vern-llm 0.5.0 → 1.0.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/dist/index.cjs +58 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -73
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +110 -73
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,52 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
interface Logger {
|
|
3
|
-
debug(message: string): void;
|
|
4
|
-
warn(message: string): void;
|
|
5
|
-
error(message: string, meta?: Record<string, unknown>): void;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Default logger. `debug` is gated by the `debug` option on VernLLM
|
|
9
|
-
* warn/error always fire since they indicate real problems (retries, cache failures)
|
|
10
|
-
*/
|
|
11
|
-
declare class ConsoleLogger implements Logger {
|
|
12
|
-
private debugEnabled;
|
|
13
|
-
constructor(debugEnabled: boolean);
|
|
14
|
-
debug(message: string): void;
|
|
15
|
-
warn(message: string): void;
|
|
16
|
-
error(message: string, meta?: Record<string, unknown>): void;
|
|
17
|
-
} //#endregion
|
|
18
|
-
//#region src/circuitBreaker.d.ts
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
21
|
-
interface CircuitBreakerOptions {
|
|
22
|
-
/** Consecutive failures before the circuit opens, default 5 */
|
|
23
|
-
threshold?: number;
|
|
24
|
-
/** How long the circuit stays open before allowing a trial request, in ms. Default 30000 */
|
|
25
|
-
cooldownMs?: number;
|
|
26
|
-
}
|
|
27
|
-
type CircuitState = 'closed' | 'open' | 'half-open';
|
|
28
|
-
/**
|
|
29
|
-
* Per retry VernLLM-instance circuit breaker. Tracks consecutive failures across
|
|
30
|
-
* calls. Once the threshold is hit, short-circuits new calls with an
|
|
31
|
-
* LLMError('circuit_open') instead of hitting the provider, until the
|
|
32
|
-
* cooldown elapses and a single trial call is allowed through
|
|
33
|
-
*/
|
|
34
|
-
declare class CircuitBreaker {
|
|
35
|
-
private state;
|
|
36
|
-
private consecutiveFailures;
|
|
37
|
-
private openedAt;
|
|
38
|
-
private threshold;
|
|
39
|
-
private cooldownMs;
|
|
40
|
-
constructor(options?: CircuitBreakerOptions);
|
|
41
|
-
/** Throws if the circuit is open and the cooldown hasnt elapsed */
|
|
42
|
-
assertClosed(): void;
|
|
43
|
-
recordSuccess(): void;
|
|
44
|
-
recordFailure(): void;
|
|
45
|
-
getState(): CircuitState;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/types.d.ts
|
|
1
|
+
//#region src/types/errors.d.ts
|
|
50
2
|
type LLMErrorType = 'timeout' | 'api' | 'parse' | 'validation' | 'circuit_open' | 'unknown' | 'aborted';
|
|
51
3
|
declare class LLMError extends Error {
|
|
52
4
|
type: LLMErrorType;
|
|
@@ -55,8 +7,15 @@ declare class LLMError extends Error {
|
|
|
55
7
|
constructor(message: string, type: LLMErrorType, status?: number | undefined, issues?: unknown | undefined);
|
|
56
8
|
}
|
|
57
9
|
declare function isLLMError(err: unknown): err is LLMError;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/types/cache.d.ts
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
58
14
|
interface CacheAdapter<T = unknown> {
|
|
59
|
-
get(key: string): Promise<
|
|
15
|
+
get(key: string): Promise<{
|
|
16
|
+
hit: boolean;
|
|
17
|
+
value: T | null;
|
|
18
|
+
}>;
|
|
60
19
|
set(key: string, value: T, ttl: number): Promise<void>;
|
|
61
20
|
delete?(key: string): Promise<void>;
|
|
62
21
|
}
|
|
@@ -65,11 +24,22 @@ interface CacheAdapter<T = unknown> {
|
|
|
65
24
|
* Not shared across processes, swap in Redis/Upstash/etc for production
|
|
66
25
|
*/
|
|
67
26
|
declare class InMemoryCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
27
|
+
private readonly maxSize;
|
|
68
28
|
private store;
|
|
69
|
-
|
|
29
|
+
constructor(maxSize?: number);
|
|
30
|
+
get(key: string): Promise<{
|
|
31
|
+
hit: boolean;
|
|
32
|
+
value: T | null;
|
|
33
|
+
}>;
|
|
70
34
|
set(key: string, value: T, ttl: number): Promise<void>;
|
|
71
35
|
delete(key: string): Promise<void>;
|
|
36
|
+
private cleanupExpiredEntries;
|
|
37
|
+
private enforceSizeLimit;
|
|
72
38
|
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/client.d.ts
|
|
42
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
73
43
|
/**
|
|
74
44
|
* Minimal shape compatible with the OpenAI SDKs chat.completions.create,
|
|
75
45
|
* so consumers can pass an OpenAI client directly
|
|
@@ -119,6 +89,10 @@ interface LLMClient {
|
|
|
119
89
|
};
|
|
120
90
|
};
|
|
121
91
|
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/types/usage.d.ts
|
|
95
|
+
//# sourceMappingURL=client.d.ts.map
|
|
122
96
|
type ReserveUsage = () => Promise<void>;
|
|
123
97
|
type RefundUsage = () => Promise<void>;
|
|
124
98
|
interface TokenUsage {
|
|
@@ -129,6 +103,10 @@ interface TokenUsage {
|
|
|
129
103
|
model: string;
|
|
130
104
|
}
|
|
131
105
|
type OnUsage = (usage: TokenUsage) => void;
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/types/schema.d.ts
|
|
109
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
132
110
|
/**
|
|
133
111
|
* Minimal structural type for a Zod-like schema, so this package doesnt need
|
|
134
112
|
* a hard dependency on a specific Zod major version. Any object exposing
|
|
@@ -143,6 +121,74 @@ interface SchemaLike<T> {
|
|
|
143
121
|
error: unknown;
|
|
144
122
|
};
|
|
145
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* A provider-native JSON Schema for structured outputs (OpenAI/Groq
|
|
126
|
+
* `response_format: { type: 'json_schema' }`) This is the wire-format
|
|
127
|
+
* schema the model is constrained to generate against, distinct from
|
|
128
|
+
* `schema`, which is a client-side Zod validator run on the parsed result
|
|
129
|
+
* You can use one, both, or neither; using both gets you provider-level
|
|
130
|
+
* constraint plus client-side type inference/validation as a safety net
|
|
131
|
+
*/
|
|
132
|
+
interface JsonSchemaSpec {
|
|
133
|
+
name: string;
|
|
134
|
+
schema: Record<string, unknown>;
|
|
135
|
+
/** Enforces the schema strictly (OpenAI-specific), default true when supported */
|
|
136
|
+
strict?: boolean;
|
|
137
|
+
description?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/circuitBreaker.d.ts
|
|
142
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
143
|
+
interface CircuitBreakerOptions {
|
|
144
|
+
/** Consecutive failures before the circuit opens, default 5 */
|
|
145
|
+
threshold?: number;
|
|
146
|
+
/** How long the circuit stays open before allowing a trial request, in ms. Default 30000 */
|
|
147
|
+
cooldownMs?: number;
|
|
148
|
+
}
|
|
149
|
+
type CircuitState = 'closed' | 'open' | 'half-open';
|
|
150
|
+
/**
|
|
151
|
+
* Per retry VernLLM-instance circuit breaker. Tracks consecutive failures across
|
|
152
|
+
* calls. Once the threshold is hit, short-circuits new calls with an
|
|
153
|
+
* LLMError('circuit_open') instead of hitting the provider, until the
|
|
154
|
+
* cooldown elapses and a single trial call is allowed through
|
|
155
|
+
*/
|
|
156
|
+
declare class CircuitBreaker {
|
|
157
|
+
private state;
|
|
158
|
+
private consecutiveFailures;
|
|
159
|
+
private openedAt;
|
|
160
|
+
private threshold;
|
|
161
|
+
private cooldownMs;
|
|
162
|
+
constructor(options?: CircuitBreakerOptions);
|
|
163
|
+
/** Throws if the circuit is open and the cooldown hasnt elapsed */
|
|
164
|
+
assertClosed(): void;
|
|
165
|
+
recordSuccess(): void;
|
|
166
|
+
recordFailure(): void;
|
|
167
|
+
getState(): CircuitState;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/logger.d.ts
|
|
172
|
+
interface Logger {
|
|
173
|
+
debug(message: string): void;
|
|
174
|
+
warn(message: string): void;
|
|
175
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Default logger. `debug` is gated by the `debug` option on VernLLM
|
|
179
|
+
* warn/error always fire since they indicate real problems (retries, cache failures)
|
|
180
|
+
*/
|
|
181
|
+
declare class ConsoleLogger implements Logger {
|
|
182
|
+
private debugEnabled;
|
|
183
|
+
constructor(debugEnabled: boolean);
|
|
184
|
+
debug(message: string): void;
|
|
185
|
+
warn(message: string): void;
|
|
186
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/types/options.d.ts
|
|
191
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
146
192
|
interface VernLLMOptions {
|
|
147
193
|
client: LLMClient;
|
|
148
194
|
model: string;
|
|
@@ -173,28 +219,17 @@ interface VernLLMOptions {
|
|
|
173
219
|
*/
|
|
174
220
|
circuitBreaker?: boolean | CircuitBreakerOptions;
|
|
175
221
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* `schema`, which is a client-side Zod validator run on the parsed result
|
|
181
|
-
* You can use one, both, or neither; using both gets you provider-level
|
|
182
|
-
* constraint plus client-side type inference/validation as a safety net
|
|
183
|
-
*/
|
|
184
|
-
interface JsonSchemaSpec {
|
|
185
|
-
name: string;
|
|
186
|
-
schema: Record<string, unknown>;
|
|
187
|
-
/** Enforces the schema strictly (OpenAI-specific), default true when supported */
|
|
188
|
-
strict?: boolean;
|
|
189
|
-
description?: string;
|
|
190
|
-
}
|
|
222
|
+
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/types/call.d.ts
|
|
225
|
+
//# sourceMappingURL=options.d.ts.map
|
|
191
226
|
/** A single prior turn in a multi-turn conversation, passed via `history`. */
|
|
192
227
|
interface ConversationTurn {
|
|
193
228
|
role: 'user' | 'assistant';
|
|
194
229
|
content: string;
|
|
195
230
|
}
|
|
196
231
|
interface CallParams<T = unknown> {
|
|
197
|
-
systemPrompt
|
|
232
|
+
systemPrompt?: string;
|
|
198
233
|
userContent: string;
|
|
199
234
|
/**
|
|
200
235
|
* Prior turns in the conversation, oldest first, NOT including the current
|
|
@@ -238,10 +273,11 @@ interface CachedCallParams<T> {
|
|
|
238
273
|
fn: () => Promise<T>;
|
|
239
274
|
reserveUsage?: ReserveUsage;
|
|
240
275
|
refundUsage?: RefundUsage;
|
|
241
|
-
}
|
|
242
|
-
//#region src/vernLLM.d.ts
|
|
276
|
+
}
|
|
243
277
|
|
|
244
|
-
//#
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/vernLLM.d.ts
|
|
280
|
+
//# sourceMappingURL=call.d.ts.map
|
|
245
281
|
/**
|
|
246
282
|
* A resilient wrapper around an LLM chat completions client, this is VernLLM!
|
|
247
283
|
*
|
|
@@ -400,9 +436,10 @@ declare class VernLLM {
|
|
|
400
436
|
* circuit breaker was configured on this instance
|
|
401
437
|
*/
|
|
402
438
|
getCircuitState(): ("closed" | "open" | "half-open") | undefined;
|
|
403
|
-
}
|
|
404
|
-
//#region src/adapters/anthropic.d.ts
|
|
439
|
+
}
|
|
405
440
|
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/adapters/anthropic.d.ts
|
|
406
443
|
//# sourceMappingURL=vernLLM.d.ts.map
|
|
407
444
|
/** Minimal structural type for the Anthropic SDKs `messages.create` */
|
|
408
445
|
interface AnthropicClient {
|
|
@@ -689,5 +726,5 @@ declare const fromOllama: typeof fromOpenAICompatible;
|
|
|
689
726
|
//#endregion
|
|
690
727
|
//# sourceMappingURL=openaiCompatible.d.ts.map
|
|
691
728
|
|
|
692
|
-
export { CacheAdapter, CachedCallParams, CallParams, CircuitBreaker, CircuitBreakerOptions, ConsoleLogger, ConversationTurn, FetchAdapterConfig, InMemoryCacheAdapter, JsonSchemaSpec, LLMClient, LLMError, LLMErrorType, Logger, OnUsage, RefundUsage, ReserveUsage, SchemaLike, TokenUsage, VernLLM, VernLLMOptions, fromAnthropic, fromBedrock, fromCerebras, fromDeepSeek, fromFetch, fromFireworks, fromGemini, fromGroq, fromMistral, fromOllama, fromOpenAICompatible, fromTogether, isLLMError };
|
|
729
|
+
export { AnthropicClient, BedrockConverseClient, CacheAdapter, CachedCallParams, CallParams, CircuitBreaker, CircuitBreakerOptions, ConsoleLogger, ConversationTurn, FetchAdapterConfig, GeminiClient, InMemoryCacheAdapter, JsonSchemaSpec, LLMClient, LLMError, LLMErrorType, Logger, OnUsage, RefundUsage, ReserveUsage, SchemaLike, TokenUsage, VernLLM, VernLLMOptions, fromAnthropic, fromBedrock, fromCerebras, fromDeepSeek, fromFetch, fromFireworks, fromGemini, fromGroq, fromMistral, fromOllama, fromOpenAICompatible, fromTogether, isLLMError };
|
|
693
730
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/errors.ts","../src/types/cache.ts","../src/types/client.ts","../src/types/usage.ts","../src/types/schema.ts","../src/circuitBreaker.ts","../src/logger.ts","../src/types/options.ts","../src/types/call.ts","../src/vernLLM.ts","../src/adapters/anthropic.ts","../src/adapters/gemini.ts","../src/adapters/bedrock.ts","../src/adapters/fetch.ts","../src/adapters/openaiCompatible.ts"],"sourcesContent":null,"mappings":";KAAY,YAAA;AAAA,cASC,QAAA,SAAiB,KAAA,CATN;EASX,IAAA,EAGI,YAHK;EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,MAGL,CAAA,EAAA,OAA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4 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
interface Logger {
|
|
3
|
-
debug(message: string): void;
|
|
4
|
-
warn(message: string): void;
|
|
5
|
-
error(message: string, meta?: Record<string, unknown>): void;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Default logger. `debug` is gated by the `debug` option on VernLLM
|
|
9
|
-
* warn/error always fire since they indicate real problems (retries, cache failures)
|
|
10
|
-
*/
|
|
11
|
-
declare class ConsoleLogger implements Logger {
|
|
12
|
-
private debugEnabled;
|
|
13
|
-
constructor(debugEnabled: boolean);
|
|
14
|
-
debug(message: string): void;
|
|
15
|
-
warn(message: string): void;
|
|
16
|
-
error(message: string, meta?: Record<string, unknown>): void;
|
|
17
|
-
} //#endregion
|
|
18
|
-
//#region src/circuitBreaker.d.ts
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
21
|
-
interface CircuitBreakerOptions {
|
|
22
|
-
/** Consecutive failures before the circuit opens, default 5 */
|
|
23
|
-
threshold?: number;
|
|
24
|
-
/** How long the circuit stays open before allowing a trial request, in ms. Default 30000 */
|
|
25
|
-
cooldownMs?: number;
|
|
26
|
-
}
|
|
27
|
-
type CircuitState = 'closed' | 'open' | 'half-open';
|
|
28
|
-
/**
|
|
29
|
-
* Per retry VernLLM-instance circuit breaker. Tracks consecutive failures across
|
|
30
|
-
* calls. Once the threshold is hit, short-circuits new calls with an
|
|
31
|
-
* LLMError('circuit_open') instead of hitting the provider, until the
|
|
32
|
-
* cooldown elapses and a single trial call is allowed through
|
|
33
|
-
*/
|
|
34
|
-
declare class CircuitBreaker {
|
|
35
|
-
private state;
|
|
36
|
-
private consecutiveFailures;
|
|
37
|
-
private openedAt;
|
|
38
|
-
private threshold;
|
|
39
|
-
private cooldownMs;
|
|
40
|
-
constructor(options?: CircuitBreakerOptions);
|
|
41
|
-
/** Throws if the circuit is open and the cooldown hasnt elapsed */
|
|
42
|
-
assertClosed(): void;
|
|
43
|
-
recordSuccess(): void;
|
|
44
|
-
recordFailure(): void;
|
|
45
|
-
getState(): CircuitState;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/types.d.ts
|
|
1
|
+
//#region src/types/errors.d.ts
|
|
50
2
|
type LLMErrorType = 'timeout' | 'api' | 'parse' | 'validation' | 'circuit_open' | 'unknown' | 'aborted';
|
|
51
3
|
declare class LLMError extends Error {
|
|
52
4
|
type: LLMErrorType;
|
|
@@ -55,8 +7,15 @@ declare class LLMError extends Error {
|
|
|
55
7
|
constructor(message: string, type: LLMErrorType, status?: number | undefined, issues?: unknown | undefined);
|
|
56
8
|
}
|
|
57
9
|
declare function isLLMError(err: unknown): err is LLMError;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/types/cache.d.ts
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
58
14
|
interface CacheAdapter<T = unknown> {
|
|
59
|
-
get(key: string): Promise<
|
|
15
|
+
get(key: string): Promise<{
|
|
16
|
+
hit: boolean;
|
|
17
|
+
value: T | null;
|
|
18
|
+
}>;
|
|
60
19
|
set(key: string, value: T, ttl: number): Promise<void>;
|
|
61
20
|
delete?(key: string): Promise<void>;
|
|
62
21
|
}
|
|
@@ -65,11 +24,22 @@ interface CacheAdapter<T = unknown> {
|
|
|
65
24
|
* Not shared across processes, swap in Redis/Upstash/etc for production
|
|
66
25
|
*/
|
|
67
26
|
declare class InMemoryCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
27
|
+
private readonly maxSize;
|
|
68
28
|
private store;
|
|
69
|
-
|
|
29
|
+
constructor(maxSize?: number);
|
|
30
|
+
get(key: string): Promise<{
|
|
31
|
+
hit: boolean;
|
|
32
|
+
value: T | null;
|
|
33
|
+
}>;
|
|
70
34
|
set(key: string, value: T, ttl: number): Promise<void>;
|
|
71
35
|
delete(key: string): Promise<void>;
|
|
36
|
+
private cleanupExpiredEntries;
|
|
37
|
+
private enforceSizeLimit;
|
|
72
38
|
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/client.d.ts
|
|
42
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
73
43
|
/**
|
|
74
44
|
* Minimal shape compatible with the OpenAI SDKs chat.completions.create,
|
|
75
45
|
* so consumers can pass an OpenAI client directly
|
|
@@ -119,6 +89,10 @@ interface LLMClient {
|
|
|
119
89
|
};
|
|
120
90
|
};
|
|
121
91
|
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/types/usage.d.ts
|
|
95
|
+
//# sourceMappingURL=client.d.ts.map
|
|
122
96
|
type ReserveUsage = () => Promise<void>;
|
|
123
97
|
type RefundUsage = () => Promise<void>;
|
|
124
98
|
interface TokenUsage {
|
|
@@ -129,6 +103,10 @@ interface TokenUsage {
|
|
|
129
103
|
model: string;
|
|
130
104
|
}
|
|
131
105
|
type OnUsage = (usage: TokenUsage) => void;
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/types/schema.d.ts
|
|
109
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
132
110
|
/**
|
|
133
111
|
* Minimal structural type for a Zod-like schema, so this package doesnt need
|
|
134
112
|
* a hard dependency on a specific Zod major version. Any object exposing
|
|
@@ -143,6 +121,74 @@ interface SchemaLike<T> {
|
|
|
143
121
|
error: unknown;
|
|
144
122
|
};
|
|
145
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* A provider-native JSON Schema for structured outputs (OpenAI/Groq
|
|
126
|
+
* `response_format: { type: 'json_schema' }`) This is the wire-format
|
|
127
|
+
* schema the model is constrained to generate against, distinct from
|
|
128
|
+
* `schema`, which is a client-side Zod validator run on the parsed result
|
|
129
|
+
* You can use one, both, or neither; using both gets you provider-level
|
|
130
|
+
* constraint plus client-side type inference/validation as a safety net
|
|
131
|
+
*/
|
|
132
|
+
interface JsonSchemaSpec {
|
|
133
|
+
name: string;
|
|
134
|
+
schema: Record<string, unknown>;
|
|
135
|
+
/** Enforces the schema strictly (OpenAI-specific), default true when supported */
|
|
136
|
+
strict?: boolean;
|
|
137
|
+
description?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/circuitBreaker.d.ts
|
|
142
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
143
|
+
interface CircuitBreakerOptions {
|
|
144
|
+
/** Consecutive failures before the circuit opens, default 5 */
|
|
145
|
+
threshold?: number;
|
|
146
|
+
/** How long the circuit stays open before allowing a trial request, in ms. Default 30000 */
|
|
147
|
+
cooldownMs?: number;
|
|
148
|
+
}
|
|
149
|
+
type CircuitState = 'closed' | 'open' | 'half-open';
|
|
150
|
+
/**
|
|
151
|
+
* Per retry VernLLM-instance circuit breaker. Tracks consecutive failures across
|
|
152
|
+
* calls. Once the threshold is hit, short-circuits new calls with an
|
|
153
|
+
* LLMError('circuit_open') instead of hitting the provider, until the
|
|
154
|
+
* cooldown elapses and a single trial call is allowed through
|
|
155
|
+
*/
|
|
156
|
+
declare class CircuitBreaker {
|
|
157
|
+
private state;
|
|
158
|
+
private consecutiveFailures;
|
|
159
|
+
private openedAt;
|
|
160
|
+
private threshold;
|
|
161
|
+
private cooldownMs;
|
|
162
|
+
constructor(options?: CircuitBreakerOptions);
|
|
163
|
+
/** Throws if the circuit is open and the cooldown hasnt elapsed */
|
|
164
|
+
assertClosed(): void;
|
|
165
|
+
recordSuccess(): void;
|
|
166
|
+
recordFailure(): void;
|
|
167
|
+
getState(): CircuitState;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/logger.d.ts
|
|
172
|
+
interface Logger {
|
|
173
|
+
debug(message: string): void;
|
|
174
|
+
warn(message: string): void;
|
|
175
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Default logger. `debug` is gated by the `debug` option on VernLLM
|
|
179
|
+
* warn/error always fire since they indicate real problems (retries, cache failures)
|
|
180
|
+
*/
|
|
181
|
+
declare class ConsoleLogger implements Logger {
|
|
182
|
+
private debugEnabled;
|
|
183
|
+
constructor(debugEnabled: boolean);
|
|
184
|
+
debug(message: string): void;
|
|
185
|
+
warn(message: string): void;
|
|
186
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/types/options.d.ts
|
|
191
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
146
192
|
interface VernLLMOptions {
|
|
147
193
|
client: LLMClient;
|
|
148
194
|
model: string;
|
|
@@ -173,28 +219,17 @@ interface VernLLMOptions {
|
|
|
173
219
|
*/
|
|
174
220
|
circuitBreaker?: boolean | CircuitBreakerOptions;
|
|
175
221
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* `schema`, which is a client-side Zod validator run on the parsed result
|
|
181
|
-
* You can use one, both, or neither; using both gets you provider-level
|
|
182
|
-
* constraint plus client-side type inference/validation as a safety net
|
|
183
|
-
*/
|
|
184
|
-
interface JsonSchemaSpec {
|
|
185
|
-
name: string;
|
|
186
|
-
schema: Record<string, unknown>;
|
|
187
|
-
/** Enforces the schema strictly (OpenAI-specific), default true when supported */
|
|
188
|
-
strict?: boolean;
|
|
189
|
-
description?: string;
|
|
190
|
-
}
|
|
222
|
+
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/types/call.d.ts
|
|
225
|
+
//# sourceMappingURL=options.d.ts.map
|
|
191
226
|
/** A single prior turn in a multi-turn conversation, passed via `history`. */
|
|
192
227
|
interface ConversationTurn {
|
|
193
228
|
role: 'user' | 'assistant';
|
|
194
229
|
content: string;
|
|
195
230
|
}
|
|
196
231
|
interface CallParams<T = unknown> {
|
|
197
|
-
systemPrompt
|
|
232
|
+
systemPrompt?: string;
|
|
198
233
|
userContent: string;
|
|
199
234
|
/**
|
|
200
235
|
* Prior turns in the conversation, oldest first, NOT including the current
|
|
@@ -238,10 +273,11 @@ interface CachedCallParams<T> {
|
|
|
238
273
|
fn: () => Promise<T>;
|
|
239
274
|
reserveUsage?: ReserveUsage;
|
|
240
275
|
refundUsage?: RefundUsage;
|
|
241
|
-
}
|
|
242
|
-
//#region src/vernLLM.d.ts
|
|
276
|
+
}
|
|
243
277
|
|
|
244
|
-
//#
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/vernLLM.d.ts
|
|
280
|
+
//# sourceMappingURL=call.d.ts.map
|
|
245
281
|
/**
|
|
246
282
|
* A resilient wrapper around an LLM chat completions client, this is VernLLM!
|
|
247
283
|
*
|
|
@@ -400,9 +436,10 @@ declare class VernLLM {
|
|
|
400
436
|
* circuit breaker was configured on this instance
|
|
401
437
|
*/
|
|
402
438
|
getCircuitState(): ("closed" | "open" | "half-open") | undefined;
|
|
403
|
-
}
|
|
404
|
-
//#region src/adapters/anthropic.d.ts
|
|
439
|
+
}
|
|
405
440
|
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/adapters/anthropic.d.ts
|
|
406
443
|
//# sourceMappingURL=vernLLM.d.ts.map
|
|
407
444
|
/** Minimal structural type for the Anthropic SDKs `messages.create` */
|
|
408
445
|
interface AnthropicClient {
|
|
@@ -689,5 +726,5 @@ declare const fromOllama: typeof fromOpenAICompatible;
|
|
|
689
726
|
//#endregion
|
|
690
727
|
//# sourceMappingURL=openaiCompatible.d.ts.map
|
|
691
728
|
|
|
692
|
-
export { CacheAdapter, CachedCallParams, CallParams, CircuitBreaker, CircuitBreakerOptions, ConsoleLogger, ConversationTurn, FetchAdapterConfig, InMemoryCacheAdapter, JsonSchemaSpec, LLMClient, LLMError, LLMErrorType, Logger, OnUsage, RefundUsage, ReserveUsage, SchemaLike, TokenUsage, VernLLM, VernLLMOptions, fromAnthropic, fromBedrock, fromCerebras, fromDeepSeek, fromFetch, fromFireworks, fromGemini, fromGroq, fromMistral, fromOllama, fromOpenAICompatible, fromTogether, isLLMError };
|
|
729
|
+
export { AnthropicClient, BedrockConverseClient, CacheAdapter, CachedCallParams, CallParams, CircuitBreaker, CircuitBreakerOptions, ConsoleLogger, ConversationTurn, FetchAdapterConfig, GeminiClient, InMemoryCacheAdapter, JsonSchemaSpec, LLMClient, LLMError, LLMErrorType, Logger, OnUsage, RefundUsage, ReserveUsage, SchemaLike, TokenUsage, VernLLM, VernLLMOptions, fromAnthropic, fromBedrock, fromCerebras, fromDeepSeek, fromFetch, fromFireworks, fromGemini, fromGroq, fromMistral, fromOllama, fromOpenAICompatible, fromTogether, isLLMError };
|
|
693
730
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/errors.ts","../src/types/cache.ts","../src/types/client.ts","../src/types/usage.ts","../src/types/schema.ts","../src/circuitBreaker.ts","../src/logger.ts","../src/types/options.ts","../src/types/call.ts","../src/vernLLM.ts","../src/adapters/anthropic.ts","../src/adapters/gemini.ts","../src/adapters/bedrock.ts","../src/adapters/fetch.ts","../src/adapters/openaiCompatible.ts"],"sourcesContent":null,"mappings":";KAAY,YAAA;AAAA,cASC,QAAA,SAAiB,KAAA,CATN;EASX,IAAA,EAGI,YAHK;EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,MAGL,CAAA,EAAA,OAAA,GAAA,SAAA;EAAY,WAAZ,CAAA,OAAA,EAAA,MAAA,EAAA,IAAA,EAAA,YAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA,EAAA,MAAA,CAAA,EAAA,OAAA,GAAA,SAAA;;AAHkB,iBAYnB,UAAA,CAZmB,GAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IAYc,QAZd;;;;AAYnC;UCrBiB;EDAL,GAAA,CAAA,GAAA,EAAA,MAAY,CAAA,ECCJ,ODDI,CAAA;IASX,GAAA,EA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