@aeye/ai 0.1.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 +1324 -0
- package/dist/ai.d.ts +204 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +837 -0
- package/dist/ai.js.map +1 -0
- package/dist/apis/base.d.ts +181 -0
- package/dist/apis/base.d.ts.map +1 -0
- package/dist/apis/base.js +359 -0
- package/dist/apis/base.js.map +1 -0
- package/dist/apis/chat.d.ts +82 -0
- package/dist/apis/chat.d.ts.map +1 -0
- package/dist/apis/chat.js +214 -0
- package/dist/apis/chat.js.map +1 -0
- package/dist/apis/embed.d.ts +27 -0
- package/dist/apis/embed.d.ts.map +1 -0
- package/dist/apis/embed.js +70 -0
- package/dist/apis/embed.js.map +1 -0
- package/dist/apis/image.d.ts +77 -0
- package/dist/apis/image.d.ts.map +1 -0
- package/dist/apis/image.js +313 -0
- package/dist/apis/image.js.map +1 -0
- package/dist/apis/models.d.ts +108 -0
- package/dist/apis/models.d.ts.map +1 -0
- package/dist/apis/models.js +118 -0
- package/dist/apis/models.js.map +1 -0
- package/dist/apis/speech.d.ts +27 -0
- package/dist/apis/speech.d.ts.map +1 -0
- package/dist/apis/speech.js +79 -0
- package/dist/apis/speech.js.map +1 -0
- package/dist/apis/transcribe.d.ts +26 -0
- package/dist/apis/transcribe.d.ts.map +1 -0
- package/dist/apis/transcribe.js +103 -0
- package/dist/apis/transcribe.js.map +1 -0
- package/dist/common.d.ts +10 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +17 -0
- package/dist/common.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/modelDetection.d.ts +31 -0
- package/dist/modelDetection.d.ts.map +1 -0
- package/dist/modelDetection.js +78 -0
- package/dist/modelDetection.js.map +1 -0
- package/dist/registry.d.ts +150 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +639 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +767 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Library Types (Instance-Based API)
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the class-based AI library.
|
|
5
|
+
* Reuses core types from @server/ai/core for consistency.
|
|
6
|
+
*/
|
|
7
|
+
import { ReadStream } from 'fs';
|
|
8
|
+
import type { Context as CoreContext, Request, Response, Chunk, Usage, Executor, Streamer, Message, Component, AnyComponent, ComponentInput, ComponentOutput, OptionalParams, ComponentCompatible, BaseResponse, BaseChunk, BaseRequest, ModelInput, Model, Simplify } from '@aeye/core';
|
|
9
|
+
import type { PromptInput } from '@aeye/core';
|
|
10
|
+
import type { ToolInput } from '@aeye/core';
|
|
11
|
+
import type { AgentInput } from '@aeye/core';
|
|
12
|
+
import { AI } from './ai';
|
|
13
|
+
export type { CoreContext, Request, Response, Chunk, Usage, Executor, Streamer, Message, Component, AnyComponent, ComponentInput, ComponentOutput, PromptInput, ToolInput, AgentInput, OptionalParams, };
|
|
14
|
+
/**
|
|
15
|
+
* Strict partial type - explicitly marks that a type should have partial properties.
|
|
16
|
+
* Used throughout the library to indicate when context/metadata can be partially provided.
|
|
17
|
+
*/
|
|
18
|
+
export type StrictPartial<T> = Partial<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Relaxes required properties of T that are present in U, making them optional.
|
|
21
|
+
* This is used to compute which context/metadata fields must be provided by the caller,
|
|
22
|
+
* after accounting for fields satisfied by default or provided context.
|
|
23
|
+
*
|
|
24
|
+
* @template T - The full type with required properties
|
|
25
|
+
* @template U - The partial type with properties that can be omitted
|
|
26
|
+
*/
|
|
27
|
+
export type Relax<T, U extends Partial<T>> = Omit<T, keyof U> & Partial<Pick<T, keyof U & keyof T>>;
|
|
28
|
+
/**
|
|
29
|
+
* Collection of AI providers mapped by name.
|
|
30
|
+
* Each provider implements the Provider interface and can have its own configuration.
|
|
31
|
+
*/
|
|
32
|
+
export type Providers = Record<string, Provider<any>>;
|
|
33
|
+
/**
|
|
34
|
+
* Capabilities that AI models can support.
|
|
35
|
+
* Used for model selection to ensure the chosen model supports required features.
|
|
36
|
+
*
|
|
37
|
+
* - chat: Basic text completion
|
|
38
|
+
* - tools: Function/tool calling
|
|
39
|
+
* - vision: Image understanding
|
|
40
|
+
* - json: JSON output mode
|
|
41
|
+
* - structured: Structured output with schemas
|
|
42
|
+
* - streaming: Streaming responses
|
|
43
|
+
* - reasoning: Extended reasoning (like OpenAI o1)
|
|
44
|
+
* - image: Image generation
|
|
45
|
+
* - audio: Text-to-speech
|
|
46
|
+
* - hearing: Speech-to-text
|
|
47
|
+
* - embedding: Text embeddings
|
|
48
|
+
* - zdr: Zero data retention
|
|
49
|
+
*/
|
|
50
|
+
export type ModelCapability = 'chat' | 'tools' | 'vision' | 'json' | 'structured' | 'streaming' | 'reasoning' | 'image' | 'audio' | 'hearing' | 'embedding' | 'zdr';
|
|
51
|
+
/**
|
|
52
|
+
* Model performance and quality tiers.
|
|
53
|
+
* Used for categorizing models by their capabilities and cost.
|
|
54
|
+
*
|
|
55
|
+
* - flagship: Top-tier models with best performance
|
|
56
|
+
* - efficient: Smaller, faster, more cost-effective models
|
|
57
|
+
* - legacy: Older models, may be deprecated
|
|
58
|
+
* - experimental: Preview/beta models
|
|
59
|
+
*/
|
|
60
|
+
export type ModelTier = 'flagship' | 'efficient' | 'legacy' | 'experimental';
|
|
61
|
+
/**
|
|
62
|
+
* Pricing information for a model.
|
|
63
|
+
* All costs are specified per 1 million tokens unless otherwise noted.
|
|
64
|
+
*/
|
|
65
|
+
export interface ModelPricing {
|
|
66
|
+
text?: {
|
|
67
|
+
input?: number;
|
|
68
|
+
output?: number;
|
|
69
|
+
cached?: number;
|
|
70
|
+
};
|
|
71
|
+
audio?: {
|
|
72
|
+
input?: number;
|
|
73
|
+
output?: number;
|
|
74
|
+
perSecond?: number;
|
|
75
|
+
};
|
|
76
|
+
image?: {
|
|
77
|
+
input?: number;
|
|
78
|
+
output?: {
|
|
79
|
+
quality: string;
|
|
80
|
+
sizes: {
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
cost: number;
|
|
84
|
+
}[];
|
|
85
|
+
}[];
|
|
86
|
+
};
|
|
87
|
+
reasoning?: {
|
|
88
|
+
input?: number;
|
|
89
|
+
output?: number;
|
|
90
|
+
cached?: number;
|
|
91
|
+
};
|
|
92
|
+
embeddings?: {
|
|
93
|
+
cost?: number;
|
|
94
|
+
};
|
|
95
|
+
perRequest?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Performance and usage metrics for a model.
|
|
99
|
+
* Tracked over time to inform model selection decisions.
|
|
100
|
+
*/
|
|
101
|
+
export interface ModelMetrics {
|
|
102
|
+
tokensPerSecond?: number;
|
|
103
|
+
timeToFirstToken?: number;
|
|
104
|
+
averageRequestDuration?: number;
|
|
105
|
+
accuracyScore?: number;
|
|
106
|
+
requestCount?: number;
|
|
107
|
+
successCount?: number;
|
|
108
|
+
failureCount?: number;
|
|
109
|
+
lastUpdated?: Date;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Complete information about an AI model.
|
|
113
|
+
* Contains capabilities, pricing, performance metrics, and metadata.
|
|
114
|
+
*
|
|
115
|
+
* @template TProvider - Provider name type (string union)
|
|
116
|
+
*/
|
|
117
|
+
export interface ModelInfo<TProvider extends string = string> extends Model {
|
|
118
|
+
id: string;
|
|
119
|
+
provider: TProvider;
|
|
120
|
+
name: string;
|
|
121
|
+
capabilities: Set<ModelCapability>;
|
|
122
|
+
tier: ModelTier;
|
|
123
|
+
pricing: ModelPricing;
|
|
124
|
+
contextWindow: number;
|
|
125
|
+
maxOutputTokens?: number;
|
|
126
|
+
metrics?: ModelMetrics;
|
|
127
|
+
tokenizer?: ModelTokenizer;
|
|
128
|
+
supportedParameters?: Set<ModelParameter>;
|
|
129
|
+
metadata?: Record<string, unknown>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Tokenizer type used by the model.
|
|
133
|
+
*/
|
|
134
|
+
export type ModelTokenizer = 'Other' | 'GPT' | 'Mistral' | 'Llama3' | 'Qwen3' | 'Qwen' | 'Gemini' | 'DeepSeek' | 'Claude' | 'Grok' | 'Llama4' | 'Llama2' | 'Cohere' | 'Nova' | 'Router';
|
|
135
|
+
/**
|
|
136
|
+
* Parameter names supported by models.
|
|
137
|
+
*/
|
|
138
|
+
export type ModelParameter = 'maxTokens' | 'temperature' | 'topP' | 'frequencyPenalty' | 'presencePenalty' | 'stop' | 'seed' | 'responseFormat' | 'structuredOutput' | 'tools' | 'toolChoice' | 'logitBias' | 'logProbabilities' | 'reason' | 'imageBackground' | 'imageMultiple' | 'imageFormat' | 'imageStream' | 'imageStyle' | 'embeddingDimensions' | 'transcribeStream' | 'transcribePrompt' | 'speechInstructions';
|
|
139
|
+
/**
|
|
140
|
+
* Override configuration for model properties.
|
|
141
|
+
* Allows customizing model information without modifying the provider implementation.
|
|
142
|
+
*
|
|
143
|
+
* @template TProvider - Provider name type (string union)
|
|
144
|
+
*/
|
|
145
|
+
export interface ModelOverride<TProvider extends string = string> {
|
|
146
|
+
provider?: TProvider;
|
|
147
|
+
modelId?: string;
|
|
148
|
+
modelPattern?: RegExp;
|
|
149
|
+
overrides: Partial<Omit<ModelInfo<TProvider>, 'id' | 'provider'>>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Weights for scoring models during selection.
|
|
153
|
+
* Higher weights prioritize that factor more heavily. Should sum to 1.0 for balanced scoring.
|
|
154
|
+
*/
|
|
155
|
+
export interface ModelSelectionWeights {
|
|
156
|
+
cost?: number;
|
|
157
|
+
speed?: number;
|
|
158
|
+
accuracy?: number;
|
|
159
|
+
contextWindow?: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Model evaluation result from search/scoring.
|
|
163
|
+
* Includes score and details about capability matching.
|
|
164
|
+
*
|
|
165
|
+
* @template TProvider - Provider name type
|
|
166
|
+
*/
|
|
167
|
+
export interface ScoredModel<TProvider extends string = string> {
|
|
168
|
+
model: ModelInfo<TProvider>;
|
|
169
|
+
score: number;
|
|
170
|
+
matchedRequired: ModelCapability[];
|
|
171
|
+
matchedOptional: ModelCapability[];
|
|
172
|
+
missingRequired: ModelCapability[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Selected model with provider instance and configuration.
|
|
176
|
+
* The result of model selection, ready to execute requests.
|
|
177
|
+
*
|
|
178
|
+
* @template TProviders - All available providers
|
|
179
|
+
* @template TProviderName - Specific selected provider name
|
|
180
|
+
*/
|
|
181
|
+
export interface SelectedModel<TProviders extends Providers = Providers, TProviderName extends keyof TProviders = keyof TProviders> {
|
|
182
|
+
model: ModelInfo<TProviderName & string>;
|
|
183
|
+
provider: TProviders[TProviderName];
|
|
184
|
+
providerConfig?: TProviders[TProviderName]['config'];
|
|
185
|
+
score: number;
|
|
186
|
+
}
|
|
187
|
+
export type SelectedModelFor<T extends AIBaseTypes> = SelectedModel<AIProviders<T>, AIProviderNames<T>>;
|
|
188
|
+
/**
|
|
189
|
+
* Container for all type information about an AI instance
|
|
190
|
+
* This is the single type parameter used throughout
|
|
191
|
+
*/
|
|
192
|
+
export type AIBaseTypes = AITypes<any, any, any, any, any, any, Providers>;
|
|
193
|
+
/**
|
|
194
|
+
* Concrete instance of AIBaseTypes with specific types
|
|
195
|
+
*/
|
|
196
|
+
export type AITypes<TContext extends AIContextUser, TDefaultContext extends StrictPartial<TContext>, TProvidedContext extends StrictPartial<TContext>, TMetadata extends AIMetadataUser, TDefaultMetadata extends StrictPartial<TMetadata>, TProvidedMetadata extends StrictPartial<TMetadata>, TProviders extends Providers> = {
|
|
197
|
+
Context: TContext;
|
|
198
|
+
DefaultContext: TDefaultContext;
|
|
199
|
+
ProvidedContext: TProvidedContext;
|
|
200
|
+
Metadata: TMetadata;
|
|
201
|
+
DefaultMetadata: TDefaultMetadata;
|
|
202
|
+
ProvidedMetadata: TProvidedMetadata;
|
|
203
|
+
Providers: TProviders;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Infer AIBaseTypes from AIConfig
|
|
207
|
+
*/
|
|
208
|
+
export type AITypesInfer<TContext extends object, TMetadata extends object, TProviders extends Providers, TConfig extends Omit<AIConfig<TContext, TMetadata, TProviders>, 'providers'>> = AITypes<TContext, TConfig['defaultContext'] extends (infer DC extends StrictPartial<TContext>) ? DC : {}, TConfig['providedContext'] extends (ctx: StrictPartial<TContext>) => Promise<infer PC extends StrictPartial<TContext>> ? PC : {}, TMetadata, TConfig['defaultMetadata'] extends (infer DM extends StrictPartial<TMetadata>) ? DM : {}, TConfig['providedMetadata'] extends (metadata: any) => Promise<infer PM extends StrictPartial<TMetadata>> ? PM : {}, TProviders>;
|
|
209
|
+
/**
|
|
210
|
+
* Extract provider names as string union
|
|
211
|
+
*/
|
|
212
|
+
export type AIProviderNames<T extends AIBaseTypes> = keyof AIProviders<T> & string;
|
|
213
|
+
/**
|
|
214
|
+
* Base metadata that all AI operations need.
|
|
215
|
+
* Provides model selection criteria and constraints.
|
|
216
|
+
*
|
|
217
|
+
* @template TProviders - Provider types for type-safe provider filtering
|
|
218
|
+
*/
|
|
219
|
+
export interface AIBaseMetadata<TProviders extends Providers> {
|
|
220
|
+
model?: ModelInput;
|
|
221
|
+
required?: ModelCapability[];
|
|
222
|
+
optional?: ModelCapability[];
|
|
223
|
+
requiredParameters?: ModelParameter[];
|
|
224
|
+
optionalParameters?: ModelParameter[];
|
|
225
|
+
providers?: {
|
|
226
|
+
allow?: (keyof TProviders)[];
|
|
227
|
+
deny?: (keyof TProviders)[];
|
|
228
|
+
};
|
|
229
|
+
budget?: {
|
|
230
|
+
maxCostPerRequest?: number;
|
|
231
|
+
maxCostPerMillionTokens?: number;
|
|
232
|
+
};
|
|
233
|
+
weights?: ModelSelectionWeights;
|
|
234
|
+
weightProfile?: string;
|
|
235
|
+
minContextWindow?: number;
|
|
236
|
+
tier?: ModelTier;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Base metadata with any types - for providers & handlers.
|
|
240
|
+
*/
|
|
241
|
+
export type AIMetadataAny = AIBaseMetadata<Providers>;
|
|
242
|
+
/**
|
|
243
|
+
* The type of user context that can be provided by the caller.
|
|
244
|
+
*/
|
|
245
|
+
export type AIMetadataUser = {
|
|
246
|
+
[P in PropertyKey]: P extends keyof AIMetadataAny ? never : any;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Base context that all AI operations get
|
|
250
|
+
*/
|
|
251
|
+
export type AIBaseContext<T extends AIBaseTypes> = {
|
|
252
|
+
ai: AI<T>;
|
|
253
|
+
metadata?: AIMetadata<T>;
|
|
254
|
+
signal?: AbortSignal;
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Base context with any types - for providers & handlers.
|
|
258
|
+
*/
|
|
259
|
+
export type AIContextAny = Partial<AIBaseContext<AIBaseTypes>>;
|
|
260
|
+
/**
|
|
261
|
+
* The type of user context that can be provided by the caller.
|
|
262
|
+
*/
|
|
263
|
+
export type AIContextUser = {
|
|
264
|
+
[P in PropertyKey]?: P extends keyof AIContextAny ? never : any;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Full context = base context + user context
|
|
268
|
+
*/
|
|
269
|
+
export type AIContext<T extends AIBaseTypes> = Simplify<AIBaseContext<T> & Omit<T['Context'], keyof AIContextAny>>;
|
|
270
|
+
/**
|
|
271
|
+
* Infers the context type from an AI instance
|
|
272
|
+
*/
|
|
273
|
+
export type AIContextInfer<A> = A extends AI<infer T> ? AIContext<T> : never;
|
|
274
|
+
/**
|
|
275
|
+
* Full context for given user/context/provider types
|
|
276
|
+
*/
|
|
277
|
+
export type AIContextFor<TContext extends AIContextUser, TMetadata extends AIMetadataUser, TProviders extends Providers> = AIContext<AITypesInfer<TContext, TMetadata, TProviders, AIConfig<TContext, TMetadata, TProviders>>> & AIContextAny;
|
|
278
|
+
/**
|
|
279
|
+
* Required context that must be provided by caller
|
|
280
|
+
* This relaxes properties that are satisfied by defaults or providers
|
|
281
|
+
*/
|
|
282
|
+
export type AIContextRequired<T extends AIBaseTypes> = Simplify<Partial<Omit<AIBaseContext<T>, 'ai'>> & Omit<Relax<T['Context'], T['DefaultContext'] & T['ProvidedContext']>, keyof AIContextAny>>;
|
|
283
|
+
/**
|
|
284
|
+
* Optional context parameter type for method signatures
|
|
285
|
+
*/
|
|
286
|
+
export type AIContextOptional<T extends AIBaseTypes> = OptionalParams<[AIContextRequired<T>]>;
|
|
287
|
+
/**
|
|
288
|
+
* Full metadata = base metadata + user metadata
|
|
289
|
+
*/
|
|
290
|
+
export type AIMetadata<T extends AIBaseTypes> = Simplify<AIBaseMetadata<AIProviders<T>> & Omit<T['Metadata'], keyof AIMetadataAny>>;
|
|
291
|
+
/**
|
|
292
|
+
* Required metadata that must be provided by caller
|
|
293
|
+
*/
|
|
294
|
+
export type AIMetadataRequired<T extends AIBaseTypes> = Simplify<AIBaseMetadata<AIProviders<T>> & Omit<Relax<T['Metadata'], T['DefaultMetadata'] & T['ProvidedMetadata']>, keyof AIMetadataAny>>;
|
|
295
|
+
/**
|
|
296
|
+
* Extract providers from AI types
|
|
297
|
+
*/
|
|
298
|
+
export type AIProviders<T extends AIBaseTypes> = T['Providers'];
|
|
299
|
+
/**
|
|
300
|
+
* Extract provider type union from AI types
|
|
301
|
+
*/
|
|
302
|
+
export type AIProvider<T extends AIBaseTypes> = T['Providers'][keyof T['Providers']];
|
|
303
|
+
/**
|
|
304
|
+
* Context passed to components (includes core context fields)
|
|
305
|
+
*/
|
|
306
|
+
export type Context<T extends AIBaseTypes> = CoreContext<AIContext<T>, AIMetadata<T>>;
|
|
307
|
+
/**
|
|
308
|
+
* Infers the component context type from an AI instance
|
|
309
|
+
*/
|
|
310
|
+
export type ContextInfer<A> = A extends AI<infer T> ? Context<T> : never;
|
|
311
|
+
/**
|
|
312
|
+
* Component type for AI instance
|
|
313
|
+
*/
|
|
314
|
+
export type ComponentFor<T extends AIBaseTypes> = ComponentCompatible<AIContextRequired<T>, AIMetadataRequired<T>>;
|
|
315
|
+
/**
|
|
316
|
+
* Request for generating images from text prompts.
|
|
317
|
+
*/
|
|
318
|
+
export interface ImageGenerationRequest extends BaseRequest {
|
|
319
|
+
prompt: string;
|
|
320
|
+
n?: number;
|
|
321
|
+
size?: string;
|
|
322
|
+
quality?: 'low' | 'medium' | 'high';
|
|
323
|
+
style?: 'vivid' | 'natural';
|
|
324
|
+
responseFormat?: 'url' | 'b64_json';
|
|
325
|
+
background?: 'transparent' | 'opaque' | 'auto';
|
|
326
|
+
streamCount?: number;
|
|
327
|
+
seed?: number;
|
|
328
|
+
userIdentifier?: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Request for editing existing images with text prompts.
|
|
332
|
+
*/
|
|
333
|
+
export interface ImageEditRequest extends BaseRequest {
|
|
334
|
+
prompt: string;
|
|
335
|
+
image: Buffer | Uint8Array | string;
|
|
336
|
+
mask?: Buffer | Uint8Array | string;
|
|
337
|
+
n?: number;
|
|
338
|
+
size?: string;
|
|
339
|
+
responseFormat?: 'url' | 'b64_json';
|
|
340
|
+
seed?: number;
|
|
341
|
+
streamCount?: number;
|
|
342
|
+
userIdentifier?: string;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Response from image generation/editing operations.
|
|
346
|
+
*/
|
|
347
|
+
export interface ImageGenerationResponse extends BaseResponse {
|
|
348
|
+
images: Array<{
|
|
349
|
+
url?: string;
|
|
350
|
+
b64_json?: string;
|
|
351
|
+
revisedPrompt?: string;
|
|
352
|
+
}>;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Streaming chunk for image generation progress.
|
|
356
|
+
*/
|
|
357
|
+
export interface ImageGenerationChunk extends BaseChunk {
|
|
358
|
+
imageData?: string;
|
|
359
|
+
progress?: number;
|
|
360
|
+
done?: boolean;
|
|
361
|
+
image?: {
|
|
362
|
+
url?: string;
|
|
363
|
+
b64_json?: string;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Request for transcribing audio to text.
|
|
368
|
+
*/
|
|
369
|
+
export interface TranscriptionRequest extends BaseRequest {
|
|
370
|
+
audio: Buffer | ReadStream | string | File;
|
|
371
|
+
language?: string;
|
|
372
|
+
prompt?: string;
|
|
373
|
+
temperature?: number;
|
|
374
|
+
responseFormat?: 'json' | 'text' | 'srt' | 'vtt' | 'verbose_json';
|
|
375
|
+
timestampGranularities?: Array<'word' | 'segment'>;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Response from audio transcription.
|
|
379
|
+
*/
|
|
380
|
+
export interface TranscriptionResponse extends BaseResponse {
|
|
381
|
+
text: string;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Streaming chunk for transcription progress.
|
|
385
|
+
*/
|
|
386
|
+
export interface TranscriptionChunk extends BaseChunk {
|
|
387
|
+
delta?: string;
|
|
388
|
+
text?: string;
|
|
389
|
+
segment?: {
|
|
390
|
+
start: number;
|
|
391
|
+
end: number;
|
|
392
|
+
speaker: string;
|
|
393
|
+
text: string;
|
|
394
|
+
id: string;
|
|
395
|
+
};
|
|
396
|
+
status?: string;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Request for generating speech from text.
|
|
400
|
+
*/
|
|
401
|
+
export interface SpeechRequest extends BaseRequest {
|
|
402
|
+
text: string;
|
|
403
|
+
instructions?: string;
|
|
404
|
+
voice?: string;
|
|
405
|
+
speed?: number;
|
|
406
|
+
responseFormat?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Response from speech synthesis.
|
|
410
|
+
*/
|
|
411
|
+
export interface SpeechResponse extends BaseResponse {
|
|
412
|
+
audio: ReadableStream<any>;
|
|
413
|
+
responseFormat?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Request for generating text embeddings.
|
|
417
|
+
*/
|
|
418
|
+
export interface EmbeddingRequest extends BaseRequest {
|
|
419
|
+
texts: string[];
|
|
420
|
+
dimensions?: number;
|
|
421
|
+
encodingFormat?: 'float' | 'base64';
|
|
422
|
+
userIdentifier?: string;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Response from embedding generation.
|
|
426
|
+
*/
|
|
427
|
+
export interface EmbeddingResponse extends BaseResponse {
|
|
428
|
+
embeddings: Array<{
|
|
429
|
+
embedding: number[];
|
|
430
|
+
index: number;
|
|
431
|
+
}>;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Request for analyzing images with vision models.
|
|
435
|
+
*/
|
|
436
|
+
export interface ImageAnalyzeRequest extends BaseRequest {
|
|
437
|
+
prompt: string;
|
|
438
|
+
images: string[];
|
|
439
|
+
maxTokens?: number;
|
|
440
|
+
temperature?: number;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Model-specific handler that overrides default provider behavior.
|
|
444
|
+
* Use handlers to provide custom implementations for specific models that differ
|
|
445
|
+
* from the provider's standard API (e.g., special Replicate models).
|
|
446
|
+
*
|
|
447
|
+
* @template TContext - Context type passed to handler methods
|
|
448
|
+
* @template TProvider - Provider name type
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* ```typescript
|
|
452
|
+
* const handler: ModelHandler = {
|
|
453
|
+
* provider: 'replicate',
|
|
454
|
+
* modelId: 'stability-ai/sdxl',
|
|
455
|
+
* imageGenerate: {
|
|
456
|
+
* get: async (request, ctx) => {
|
|
457
|
+
* // Custom implementation for this specific model
|
|
458
|
+
* return customImageGeneration(request, ctx);
|
|
459
|
+
* }
|
|
460
|
+
* }
|
|
461
|
+
* };
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
export interface ModelHandler<TContext extends AIContextAny = AIContextAny> {
|
|
465
|
+
models: string[];
|
|
466
|
+
chat?: {
|
|
467
|
+
get?: <TRuntimeContext extends TContext>(request: Request, ctx: TRuntimeContext) => Promise<Response>;
|
|
468
|
+
stream?: <TRuntimeContext extends TContext>(request: Request, ctx: TRuntimeContext) => AsyncIterable<Chunk>;
|
|
469
|
+
};
|
|
470
|
+
imageGenerate?: {
|
|
471
|
+
get?: <TRuntimeContext extends TContext>(request: ImageGenerationRequest, ctx: TRuntimeContext) => Promise<ImageGenerationResponse>;
|
|
472
|
+
stream?: <TRuntimeContext extends TContext>(request: ImageGenerationRequest, ctx: TRuntimeContext) => AsyncIterable<ImageGenerationChunk>;
|
|
473
|
+
};
|
|
474
|
+
imageEdit?: {
|
|
475
|
+
get?: <TRuntimeContext extends TContext>(request: ImageEditRequest, ctx: TRuntimeContext) => Promise<ImageGenerationResponse>;
|
|
476
|
+
stream?: <TRuntimeContext extends TContext>(request: ImageEditRequest, ctx: TRuntimeContext) => AsyncIterable<ImageGenerationChunk>;
|
|
477
|
+
};
|
|
478
|
+
imageAnalyze?: {
|
|
479
|
+
get?: <TRuntimeContext extends TContext>(request: ImageAnalyzeRequest, ctx: TRuntimeContext) => Promise<Response>;
|
|
480
|
+
streem?: <TRuntimeContext extends TContext>(request: ImageAnalyzeRequest, ctx: TRuntimeContext) => AsyncIterable<Chunk>;
|
|
481
|
+
};
|
|
482
|
+
transcribe?: {
|
|
483
|
+
get?: <TRuntimeContext extends TContext>(request: TranscriptionRequest, ctx: TRuntimeContext) => Promise<TranscriptionResponse>;
|
|
484
|
+
stream?: <TRuntimeContext extends TContext>(request: TranscriptionRequest, ctx: TRuntimeContext) => AsyncIterable<TranscriptionChunk>;
|
|
485
|
+
};
|
|
486
|
+
speech?: {
|
|
487
|
+
get?: <TRuntimeContext extends TContext>(request: SpeechRequest, ctx: TRuntimeContext) => Promise<SpeechResponse>;
|
|
488
|
+
};
|
|
489
|
+
embed?: {
|
|
490
|
+
get?: <TRuntimeContext extends TContext>(request: EmbeddingRequest, ctx: TRuntimeContext) => Promise<EmbeddingResponse>;
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Model handler for AIBaseTypes instance
|
|
495
|
+
*/
|
|
496
|
+
export type ModelHandlerFor<T extends AIBaseTypes> = ModelHandler<AIContext<T>>;
|
|
497
|
+
/**
|
|
498
|
+
* Model transformer for providers with inconsistent request/response shapes.
|
|
499
|
+
* Transforms standard requests/responses to/from provider-specific formats.
|
|
500
|
+
* Useful for adapting providers like Replicate that have model-specific APIs.
|
|
501
|
+
*
|
|
502
|
+
* @template TContext - Context type passed to transformer methods
|
|
503
|
+
*/
|
|
504
|
+
export interface ModelTransformer {
|
|
505
|
+
chat?: {
|
|
506
|
+
convertRequest?: (request: Request, ctx: AIContextAny) => object;
|
|
507
|
+
parseResponse?: (response: object, ctx: AIContextAny) => Response;
|
|
508
|
+
parseChunk?: (chunk: object, ctx: AIContextAny) => Chunk;
|
|
509
|
+
};
|
|
510
|
+
imageGenerate?: {
|
|
511
|
+
convertRequest?: (request: ImageGenerationRequest, ctx: AIContextAny) => object;
|
|
512
|
+
parseResponse?: (response: object, ctx: AIContextAny) => ImageGenerationResponse;
|
|
513
|
+
parseChunk?: (chunk: object, ctx: AIContextAny) => ImageGenerationChunk;
|
|
514
|
+
};
|
|
515
|
+
imageEdit?: {
|
|
516
|
+
convertRequest?: (request: ImageEditRequest, ctx: AIContextAny) => object;
|
|
517
|
+
parseResponse?: (response: object, ctx: AIContextAny) => ImageGenerationResponse;
|
|
518
|
+
parseChunk?: (chunk: object, ctx: AIContextAny) => ImageGenerationChunk;
|
|
519
|
+
};
|
|
520
|
+
imageAnalyze?: {
|
|
521
|
+
convertRequest?: (request: ImageAnalyzeRequest, ctx: AIContextAny) => object;
|
|
522
|
+
parseResponse?: (response: object, ctx: AIContextAny) => Response;
|
|
523
|
+
parseChunk?: (chunk: object, ctx: AIContextAny) => Chunk;
|
|
524
|
+
};
|
|
525
|
+
transcribe?: {
|
|
526
|
+
convertRequest?: (request: TranscriptionRequest, ctx: AIContextAny) => object;
|
|
527
|
+
parseResponse?: (response: object, ctx: AIContextAny) => TranscriptionResponse;
|
|
528
|
+
parseChunk?: (chunk: object, ctx: AIContextAny) => TranscriptionChunk;
|
|
529
|
+
};
|
|
530
|
+
speech?: {
|
|
531
|
+
convertRequest?: (request: SpeechRequest, ctx: AIContextAny) => object;
|
|
532
|
+
parseResponse?: (response: object, ctx: AIContextAny) => SpeechResponse;
|
|
533
|
+
};
|
|
534
|
+
embed?: {
|
|
535
|
+
convertRequest?: (request: EmbeddingRequest, ctx: AIContextAny) => object;
|
|
536
|
+
parseResponse?: (response: object, ctx: AIContextAny) => EmbeddingResponse;
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* External source of model information.
|
|
541
|
+
* Model sources fetch model metadata from external registries (e.g., OpenRouter)
|
|
542
|
+
* to enrich provider model information with pricing, capabilities, and metrics.
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```typescript
|
|
546
|
+
* const openRouterSource: ModelSource = {
|
|
547
|
+
* name: 'openrouter',
|
|
548
|
+
* fetchModels: async () => {
|
|
549
|
+
* const response = await fetch('https://openrouter.ai/api/v1/models');
|
|
550
|
+
* return parseModels(response);
|
|
551
|
+
* }
|
|
552
|
+
* };
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
export interface ModelSource {
|
|
556
|
+
name: string;
|
|
557
|
+
fetchModels(config?: Record<string, unknown>): Promise<ModelInfo[]>;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* AI provider implementation interface.
|
|
561
|
+
* Providers implement the actual communication with AI services (OpenAI, Anthropic, etc.).
|
|
562
|
+
* They expose methods for different capabilities (chat, images, speech, etc.).
|
|
563
|
+
*
|
|
564
|
+
* @template TConfig - Provider-specific configuration type
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```typescript
|
|
568
|
+
* const openai: Provider<OpenAIConfig> = {
|
|
569
|
+
* name: 'openai',
|
|
570
|
+
* config: { apiKey: process.env.OPENAI_API_KEY },
|
|
571
|
+
*
|
|
572
|
+
* async listModels() {
|
|
573
|
+
* // Fetch available models from OpenAI
|
|
574
|
+
* return [...];
|
|
575
|
+
* },
|
|
576
|
+
*
|
|
577
|
+
* async checkHealth() {
|
|
578
|
+
* // Verify API is accessible
|
|
579
|
+
* return true;
|
|
580
|
+
* },
|
|
581
|
+
*
|
|
582
|
+
* createExecutor() {
|
|
583
|
+
* // Return chat completion function
|
|
584
|
+
* return async (request, ctx, metadata) => {
|
|
585
|
+
* // Make API call
|
|
586
|
+
* return response;
|
|
587
|
+
* };
|
|
588
|
+
* },
|
|
589
|
+
*
|
|
590
|
+
* // ... other methods
|
|
591
|
+
* };
|
|
592
|
+
* ```
|
|
593
|
+
*/
|
|
594
|
+
export interface Provider<TConfig = any> {
|
|
595
|
+
name: string;
|
|
596
|
+
config: TConfig;
|
|
597
|
+
priority?: number;
|
|
598
|
+
defaultMetadata?: Partial<AIBaseMetadata<any>>;
|
|
599
|
+
listModels?(config?: TConfig): Promise<ModelInfo[]>;
|
|
600
|
+
checkHealth(config?: TConfig): Promise<boolean>;
|
|
601
|
+
createExecutor?(config?: TConfig): Executor<AIContextAny, AIMetadataAny>;
|
|
602
|
+
createStreamer?(config?: TConfig): Streamer<AIContextAny, AIMetadataAny>;
|
|
603
|
+
generateImage?(request: ImageGenerationRequest, ctx: AIContextAny, config?: TConfig): Promise<ImageGenerationResponse>;
|
|
604
|
+
generateImageStream?(request: ImageGenerationRequest, ctx: AIContextAny, config?: TConfig): AsyncIterable<ImageGenerationChunk>;
|
|
605
|
+
editImage?(request: ImageEditRequest, ctx: AIContextAny, config?: TConfig): Promise<ImageGenerationResponse>;
|
|
606
|
+
editImageStream?(request: ImageEditRequest, ctx: AIContextAny, config?: TConfig): AsyncIterable<ImageGenerationChunk>;
|
|
607
|
+
transcribe?(request: TranscriptionRequest, ctx: AIContextAny, config?: TConfig): Promise<TranscriptionResponse>;
|
|
608
|
+
transcribeStream?(request: TranscriptionRequest, ctx: AIContextAny, config?: TConfig): AsyncIterable<TranscriptionChunk>;
|
|
609
|
+
speech?(request: SpeechRequest, ctx: AIContextAny, config?: TConfig): Promise<SpeechResponse>;
|
|
610
|
+
embed?(request: EmbeddingRequest, ctx: AIContextAny, config?: TConfig): Promise<EmbeddingResponse>;
|
|
611
|
+
analyzeImage?(request: ImageAnalyzeRequest, ctx: AIContextAny, config?: TConfig): Promise<Response>;
|
|
612
|
+
analyzeImageStream?(request: ImageAnalyzeRequest, ctx: AIContextAny, config?: TConfig): AsyncIterable<Chunk>;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Lifecycle hooks for AI operations.
|
|
616
|
+
* Hooks allow you to intercept and modify AI operations at key points:
|
|
617
|
+
* - Model selection
|
|
618
|
+
* - Before/after requests
|
|
619
|
+
* - Error handling
|
|
620
|
+
*
|
|
621
|
+
* @template T - AIBaseTypes container
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```typescript
|
|
625
|
+
* const hooks: AIHooks<MyAITypes> = {
|
|
626
|
+
* beforeRequest: async (ctx, selected, tokens, cost) => {
|
|
627
|
+
* console.log(`Using ${selected.model.id}, estimated ${tokens} tokens, cost ${cost}`);
|
|
628
|
+
*
|
|
629
|
+
* // Check budget
|
|
630
|
+
* if (ctx.user.budget < estimatedCost) {
|
|
631
|
+
* throw new Error('Insufficient budget');
|
|
632
|
+
* }
|
|
633
|
+
* },
|
|
634
|
+
*
|
|
635
|
+
* afterRequest: async (ctx, selected, usage, cost) => {
|
|
636
|
+
* // Track usage in database
|
|
637
|
+
* await db.logUsage(ctx.user.id, usage, cost);
|
|
638
|
+
* },
|
|
639
|
+
*
|
|
640
|
+
* onError: (type, message, error, ctx) => {
|
|
641
|
+
* logger.error(`AI Error [${type}]: ${message}`, error);
|
|
642
|
+
* }
|
|
643
|
+
* };
|
|
644
|
+
* ```
|
|
645
|
+
*/
|
|
646
|
+
export interface AIHooks<T extends AIBaseTypes> {
|
|
647
|
+
/**
|
|
648
|
+
* Called before model selection, allows modifying metadata.
|
|
649
|
+
* Use this to dynamically adjust model selection criteria based on context.
|
|
650
|
+
*/
|
|
651
|
+
beforeModelSelection?: (ctx: AIContext<T>, request: BaseRequest, metadata: AIMetadata<T>) => Promise<AIMetadata<T>> | AIMetadata<T>;
|
|
652
|
+
/**
|
|
653
|
+
* Called after model selection, can override the selected model or config.
|
|
654
|
+
* Return a modified SelectedModel to change the selection, or void to accept it.
|
|
655
|
+
*/
|
|
656
|
+
onModelSelected?: (ctx: AIContext<T>, request: BaseRequest, selected: SelectedModelFor<T>) => Promise<SelectedModelFor<T> | void> | SelectedModelFor<T> | void;
|
|
657
|
+
/**
|
|
658
|
+
* Called before making the API request.
|
|
659
|
+
* Use this for budget checks, rate limiting, or logging.
|
|
660
|
+
* Throw an error to cancel the request.
|
|
661
|
+
*/
|
|
662
|
+
beforeRequest?: (ctx: AIContext<T>, request: BaseRequest, selected: SelectedModelFor<T>, estimatedUsage: Usage, estimatedCost: number) => Promise<void> | void;
|
|
663
|
+
/**
|
|
664
|
+
* Called after successful request completion.
|
|
665
|
+
* Use this to track usage, update budgets, or log metrics.
|
|
666
|
+
*/
|
|
667
|
+
afterRequest?: (ctx: AIContext<T>, request: BaseRequest, response: BaseResponse, responseComplete: boolean, selected: SelectedModelFor<T>, usage: Usage, cost: number) => Promise<void> | void;
|
|
668
|
+
/**
|
|
669
|
+
* Called when an error occurs in any AI operation.
|
|
670
|
+
* Use this for centralized error logging and monitoring.
|
|
671
|
+
*/
|
|
672
|
+
onError?: (errorType: string, message: string, error?: Error, ctx?: AIContext<T> | AIContextRequired<T>, request?: BaseRequest) => void;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Configuration for creating an AI instance.
|
|
676
|
+
* Defines providers, context, metadata, and model management settings.
|
|
677
|
+
*
|
|
678
|
+
* @template TContext - Custom context type
|
|
679
|
+
* @template TMetadata - Custom metadata type
|
|
680
|
+
* @template TProviders - Available providers
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```typescript
|
|
684
|
+
* const config: AIConfig<AppContext, AppMetadata, typeof providers> = {
|
|
685
|
+
* // Context management
|
|
686
|
+
* defaultContext: {
|
|
687
|
+
* apiVersion: 'v1'
|
|
688
|
+
* },
|
|
689
|
+
* providedContext: async (ctx) => ({
|
|
690
|
+
* user: await getUser(ctx.userId),
|
|
691
|
+
* db: database
|
|
692
|
+
* }),
|
|
693
|
+
*
|
|
694
|
+
* // Providers
|
|
695
|
+
* providers: { openai, anthropic },
|
|
696
|
+
*
|
|
697
|
+
* // Model configuration
|
|
698
|
+
* models: customModels,
|
|
699
|
+
* modelOverrides: [
|
|
700
|
+
* {
|
|
701
|
+
* modelPattern: /gpt-4/,
|
|
702
|
+
* overrides: { pricing: customPricing }
|
|
703
|
+
* }
|
|
704
|
+
* ],
|
|
705
|
+
*
|
|
706
|
+
* // Model sources
|
|
707
|
+
* modelSources: [openRouterSource],
|
|
708
|
+
*
|
|
709
|
+
* // Selection profiles
|
|
710
|
+
* defaultWeights: { cost: 0.6, speed: 0.4 },
|
|
711
|
+
* profiles: {
|
|
712
|
+
* costPriority: { cost: 0.9, speed: 0.1 },
|
|
713
|
+
* performance: { cost: 0.1, speed: 0.5, accuracy: 0.4 }
|
|
714
|
+
* }
|
|
715
|
+
* };
|
|
716
|
+
* ```
|
|
717
|
+
*/
|
|
718
|
+
export interface AIConfig<TContext extends AIContextUser, TMetadata extends AIMetadataUser, TProviders extends Providers> {
|
|
719
|
+
defaultContext?: StrictPartial<TContext>;
|
|
720
|
+
providedContext?: (ctx: StrictPartial<TContext>) => Promise<StrictPartial<TContext>>;
|
|
721
|
+
defaultMetadata?: StrictPartial<Omit<TMetadata, keyof AIMetadataAny> & AIBaseMetadata<TProviders>>;
|
|
722
|
+
providedMetadata?: (metadata: StrictPartial<Omit<TMetadata, keyof AIMetadataAny> & AIBaseMetadata<TProviders>>) => Promise<StrictPartial<TMetadata> & AIBaseMetadata<TProviders>>;
|
|
723
|
+
providers: TProviders;
|
|
724
|
+
models?: ModelInfo[];
|
|
725
|
+
modelOverrides?: ModelOverride[];
|
|
726
|
+
modelHandlers?: ModelHandler<AIContextFor<TContext, TMetadata, TProviders>>[];
|
|
727
|
+
modelSources?: ModelSource[];
|
|
728
|
+
defaultWeights?: ModelSelectionWeights;
|
|
729
|
+
weightProfiles?: Record<string, ModelSelectionWeights>;
|
|
730
|
+
tokens?: {
|
|
731
|
+
textDivisor?: number;
|
|
732
|
+
textBase64Divisor?: number;
|
|
733
|
+
textFallback?: number;
|
|
734
|
+
textMax?: number;
|
|
735
|
+
imageDivisor?: number;
|
|
736
|
+
imageBase64Divisor?: number;
|
|
737
|
+
imageFallback?: number;
|
|
738
|
+
imageMax?: number;
|
|
739
|
+
fileDivisor?: number;
|
|
740
|
+
fileBase64Divisor?: number;
|
|
741
|
+
fileFallback?: number;
|
|
742
|
+
fileMax?: number;
|
|
743
|
+
audioDivisor?: number;
|
|
744
|
+
audioBase64Divisor?: number;
|
|
745
|
+
audioFallback?: number;
|
|
746
|
+
audioMax?: number;
|
|
747
|
+
};
|
|
748
|
+
defaultCostPerMillionTokens?: number;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Extract AIConfig type from AIBaseTypes
|
|
752
|
+
*/
|
|
753
|
+
export type AIConfigOf<T extends AIBaseTypes> = AIConfig<T['Context'], T['Metadata'], AIProviders<T>>;
|
|
754
|
+
/**
|
|
755
|
+
* Runtime statistics about the AI instance.
|
|
756
|
+
* Provides insights into model usage and performance.
|
|
757
|
+
*/
|
|
758
|
+
export interface LibraryStats {
|
|
759
|
+
totalModels: number;
|
|
760
|
+
modelsByProvider: Record<string, number>;
|
|
761
|
+
totalRequests: number;
|
|
762
|
+
successfulRequests: number;
|
|
763
|
+
failedRequests: number;
|
|
764
|
+
averageCost: number;
|
|
765
|
+
averageLatency: number;
|
|
766
|
+
}
|
|
767
|
+
//# sourceMappingURL=types.d.ts.map
|