@ax-llm/ax 10.0.27 → 10.0.28
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/index.cjs +6986 -0
- package/index.cjs.map +1 -0
- package/index.d.cts +2102 -0
- package/index.d.ts +2102 -0
- package/index.js +6891 -0
- package/index.js.map +1 -0
- package/package.json +2 -2
package/index.d.cts
ADDED
|
@@ -0,0 +1,2102 @@
|
|
|
1
|
+
import { ReadableStream } from 'stream/web';
|
|
2
|
+
import { Tracer, Span } from '@opentelemetry/api';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Util: API details
|
|
6
|
+
*/
|
|
7
|
+
type AxAPI = {
|
|
8
|
+
name?: string;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
put?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type AxAIModelMap = Record<string, string>;
|
|
14
|
+
type AxModelInfo = {
|
|
15
|
+
name: string;
|
|
16
|
+
currency?: string;
|
|
17
|
+
characterIsToken?: boolean;
|
|
18
|
+
promptTokenCostPer1M?: number;
|
|
19
|
+
completionTokenCostPer1M?: number;
|
|
20
|
+
aliases?: string[];
|
|
21
|
+
};
|
|
22
|
+
type AxTokenUsage = {
|
|
23
|
+
promptTokens: number;
|
|
24
|
+
completionTokens: number;
|
|
25
|
+
totalTokens: number;
|
|
26
|
+
};
|
|
27
|
+
type AxModelConfig = {
|
|
28
|
+
maxTokens?: number;
|
|
29
|
+
temperature?: number;
|
|
30
|
+
topP?: number;
|
|
31
|
+
topK?: number;
|
|
32
|
+
presencePenalty?: number;
|
|
33
|
+
frequencyPenalty?: number;
|
|
34
|
+
stopSequences?: string[];
|
|
35
|
+
endSequences?: string[];
|
|
36
|
+
stream?: boolean;
|
|
37
|
+
n?: number;
|
|
38
|
+
};
|
|
39
|
+
type AxFunctionHandler = (args?: any, extra?: Readonly<{
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
traceId?: string;
|
|
42
|
+
}>) => unknown;
|
|
43
|
+
type AxFunctionJSONSchema = {
|
|
44
|
+
type: string;
|
|
45
|
+
properties?: Record<string, AxFunctionJSONSchema & {
|
|
46
|
+
enum?: string[];
|
|
47
|
+
description: string;
|
|
48
|
+
}>;
|
|
49
|
+
required?: string[];
|
|
50
|
+
items?: AxFunctionJSONSchema;
|
|
51
|
+
};
|
|
52
|
+
type AxFunction = {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
parameters?: AxFunctionJSONSchema;
|
|
56
|
+
func: AxFunctionHandler;
|
|
57
|
+
};
|
|
58
|
+
type AxChatResponseResult = {
|
|
59
|
+
content?: string;
|
|
60
|
+
name?: string;
|
|
61
|
+
id?: string;
|
|
62
|
+
functionCalls?: {
|
|
63
|
+
id: string;
|
|
64
|
+
type: 'function';
|
|
65
|
+
function: {
|
|
66
|
+
name: string;
|
|
67
|
+
params?: string | object;
|
|
68
|
+
};
|
|
69
|
+
}[];
|
|
70
|
+
finishReason?: 'stop' | 'length' | 'function_call' | 'content_filter' | 'error';
|
|
71
|
+
};
|
|
72
|
+
type AxChatResponse = {
|
|
73
|
+
sessionId?: string;
|
|
74
|
+
remoteId?: string;
|
|
75
|
+
results: readonly AxChatResponseResult[];
|
|
76
|
+
modelUsage?: AxTokenUsage;
|
|
77
|
+
embedModelUsage?: AxTokenUsage;
|
|
78
|
+
};
|
|
79
|
+
type AxEmbedResponse = {
|
|
80
|
+
remoteId?: string;
|
|
81
|
+
sessionId?: string;
|
|
82
|
+
embeddings: readonly (readonly number[])[];
|
|
83
|
+
modelUsage?: AxTokenUsage;
|
|
84
|
+
};
|
|
85
|
+
type AxModelInfoWithProvider = AxModelInfo & {
|
|
86
|
+
provider: string;
|
|
87
|
+
};
|
|
88
|
+
type AxChatRequest = {
|
|
89
|
+
chatPrompt: Readonly<{
|
|
90
|
+
role: 'system';
|
|
91
|
+
content: string;
|
|
92
|
+
cache?: boolean;
|
|
93
|
+
} | {
|
|
94
|
+
role: 'user';
|
|
95
|
+
name?: string;
|
|
96
|
+
content: string | ({
|
|
97
|
+
type: 'text';
|
|
98
|
+
text: string;
|
|
99
|
+
cache?: boolean;
|
|
100
|
+
} | {
|
|
101
|
+
type: 'image';
|
|
102
|
+
mimeType: string;
|
|
103
|
+
image: string;
|
|
104
|
+
details?: 'high' | 'low' | 'auto';
|
|
105
|
+
cache?: boolean;
|
|
106
|
+
} | {
|
|
107
|
+
type: 'audio';
|
|
108
|
+
data: string;
|
|
109
|
+
format?: 'wav';
|
|
110
|
+
cache?: boolean;
|
|
111
|
+
})[];
|
|
112
|
+
} | {
|
|
113
|
+
role: 'assistant';
|
|
114
|
+
content?: string;
|
|
115
|
+
name?: string;
|
|
116
|
+
functionCalls?: {
|
|
117
|
+
id: string;
|
|
118
|
+
type: 'function';
|
|
119
|
+
function: {
|
|
120
|
+
name: string;
|
|
121
|
+
params?: string | object;
|
|
122
|
+
};
|
|
123
|
+
}[];
|
|
124
|
+
cache?: boolean;
|
|
125
|
+
} | {
|
|
126
|
+
role: 'function';
|
|
127
|
+
result: string;
|
|
128
|
+
functionId: string;
|
|
129
|
+
cache?: boolean;
|
|
130
|
+
}>[];
|
|
131
|
+
functions?: Readonly<{
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
parameters?: AxFunctionJSONSchema;
|
|
135
|
+
}>[];
|
|
136
|
+
functionCall?: 'none' | 'auto' | 'required' | {
|
|
137
|
+
type: 'function';
|
|
138
|
+
function: {
|
|
139
|
+
name: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
modelConfig?: Readonly<AxModelConfig>;
|
|
143
|
+
model?: string;
|
|
144
|
+
};
|
|
145
|
+
interface AxAIServiceMetrics {
|
|
146
|
+
latency: {
|
|
147
|
+
chat: {
|
|
148
|
+
mean: number;
|
|
149
|
+
p95: number;
|
|
150
|
+
p99: number;
|
|
151
|
+
samples: number[];
|
|
152
|
+
};
|
|
153
|
+
embed: {
|
|
154
|
+
mean: number;
|
|
155
|
+
p95: number;
|
|
156
|
+
p99: number;
|
|
157
|
+
samples: number[];
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
errors: {
|
|
161
|
+
chat: {
|
|
162
|
+
count: number;
|
|
163
|
+
rate: number;
|
|
164
|
+
total: number;
|
|
165
|
+
};
|
|
166
|
+
embed: {
|
|
167
|
+
count: number;
|
|
168
|
+
rate: number;
|
|
169
|
+
total: number;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
type AxInternalChatRequest = Omit<AxChatRequest, 'model'> & Required<Pick<AxChatRequest, 'model'>>;
|
|
174
|
+
type AxEmbedRequest = {
|
|
175
|
+
texts?: readonly string[];
|
|
176
|
+
embedModel?: string;
|
|
177
|
+
};
|
|
178
|
+
type AxInternalEmbedRequest = Omit<AxEmbedRequest, 'embedModel'> & Required<Pick<AxEmbedRequest, 'embedModel'>>;
|
|
179
|
+
type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream<T>>, info: Readonly<{
|
|
180
|
+
modelUsage?: AxTokenUsage;
|
|
181
|
+
embedModelUsage?: AxTokenUsage;
|
|
182
|
+
}>) => Promise<T | ReadableStream<T>>;
|
|
183
|
+
type AxAIPromptConfig = {
|
|
184
|
+
stream?: boolean;
|
|
185
|
+
};
|
|
186
|
+
type AxAIServiceOptions = {
|
|
187
|
+
debug?: boolean;
|
|
188
|
+
rateLimiter?: AxRateLimiterFunction;
|
|
189
|
+
fetch?: typeof fetch;
|
|
190
|
+
tracer?: Tracer;
|
|
191
|
+
};
|
|
192
|
+
type AxAIServiceActionOptions = {
|
|
193
|
+
ai?: Readonly<AxAIService>;
|
|
194
|
+
sessionId?: string;
|
|
195
|
+
traceId?: string;
|
|
196
|
+
rateLimiter?: AxRateLimiterFunction;
|
|
197
|
+
};
|
|
198
|
+
interface AxAIService {
|
|
199
|
+
getName(): string;
|
|
200
|
+
getModelInfo(): Readonly<AxModelInfoWithProvider>;
|
|
201
|
+
getEmbedModelInfo(): Readonly<AxModelInfoWithProvider> | undefined;
|
|
202
|
+
getFeatures(model?: string): {
|
|
203
|
+
functions: boolean;
|
|
204
|
+
streaming: boolean;
|
|
205
|
+
};
|
|
206
|
+
getModelMap(): AxAIModelMap | undefined;
|
|
207
|
+
getMetrics(): AxAIServiceMetrics;
|
|
208
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
209
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
210
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
211
|
+
}
|
|
212
|
+
interface AxAIServiceImpl<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse> {
|
|
213
|
+
createChatReq(req: Readonly<AxInternalChatRequest>, config: Readonly<AxAIPromptConfig>): [AxAPI, TChatRequest];
|
|
214
|
+
createChatResp(resp: Readonly<TChatResponse>): AxChatResponse;
|
|
215
|
+
createChatStreamResp?(resp: Readonly<TChatResponseDelta>, state: object): AxChatResponse;
|
|
216
|
+
createEmbedReq?(req: Readonly<AxInternalEmbedRequest>): [AxAPI, TEmbedRequest];
|
|
217
|
+
createEmbedResp?(resp: Readonly<TEmbedResponse>): AxEmbedResponse;
|
|
218
|
+
getModelConfig(): AxModelConfig;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface AxBaseAIFeatures {
|
|
222
|
+
functions: boolean;
|
|
223
|
+
streaming: boolean;
|
|
224
|
+
}
|
|
225
|
+
interface AxBaseAIArgs {
|
|
226
|
+
name: string;
|
|
227
|
+
apiURL: string;
|
|
228
|
+
headers: Record<string, string>;
|
|
229
|
+
modelInfo: Readonly<AxModelInfo[]>;
|
|
230
|
+
models: Readonly<{
|
|
231
|
+
model: string;
|
|
232
|
+
embedModel?: string;
|
|
233
|
+
}>;
|
|
234
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
235
|
+
supportFor: AxBaseAIFeatures | ((model: string) => AxBaseAIFeatures);
|
|
236
|
+
modelMap?: AxAIModelMap;
|
|
237
|
+
}
|
|
238
|
+
declare class AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse> implements AxAIService {
|
|
239
|
+
private readonly aiImpl;
|
|
240
|
+
private debug;
|
|
241
|
+
private rt?;
|
|
242
|
+
private fetch?;
|
|
243
|
+
private tracer?;
|
|
244
|
+
private modelMap?;
|
|
245
|
+
private modelInfo;
|
|
246
|
+
private modelUsage?;
|
|
247
|
+
private embedModelUsage?;
|
|
248
|
+
private models;
|
|
249
|
+
protected apiURL: string;
|
|
250
|
+
protected name: string;
|
|
251
|
+
protected headers: Record<string, string>;
|
|
252
|
+
protected supportFor: AxBaseAIFeatures | ((model: string) => AxBaseAIFeatures);
|
|
253
|
+
private metrics;
|
|
254
|
+
constructor(aiImpl: Readonly<AxAIServiceImpl<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>, { name, apiURL, headers, modelInfo, models, options, supportFor, modelMap, }: Readonly<AxBaseAIArgs>);
|
|
255
|
+
setName(name: string): void;
|
|
256
|
+
setAPIURL(apiURL: string): void;
|
|
257
|
+
setHeaders(headers: Record<string, string>): void;
|
|
258
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
259
|
+
getModelInfo(): Readonly<AxModelInfoWithProvider>;
|
|
260
|
+
getEmbedModelInfo(): AxModelInfoWithProvider | undefined;
|
|
261
|
+
getModelMap(): AxAIModelMap | undefined;
|
|
262
|
+
getName(): string;
|
|
263
|
+
getFeatures(model?: string): AxBaseAIFeatures;
|
|
264
|
+
private calculatePercentile;
|
|
265
|
+
private updateLatencyMetrics;
|
|
266
|
+
private updateErrorMetrics;
|
|
267
|
+
getMetrics(): AxAIServiceMetrics;
|
|
268
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
269
|
+
private _chat1;
|
|
270
|
+
private _chat2;
|
|
271
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
272
|
+
private _embed1;
|
|
273
|
+
private _embed2;
|
|
274
|
+
private buildHeaders;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare enum AxAIAnthropicModel {
|
|
278
|
+
Claude35Sonnet = "claude-3-5-sonnet-latest",
|
|
279
|
+
Claude35Haiku = "claude-3-5-haiku-latest",
|
|
280
|
+
Claude3Opus = "claude-3-opus-latest",
|
|
281
|
+
Claude3Sonnet = "claude-3-sonnet-20240229",
|
|
282
|
+
Claude3Haiku = "claude-3-haiku-20240307",
|
|
283
|
+
Claude21 = "claude-2.1",
|
|
284
|
+
ClaudeInstant12 = "claude-instant-1.2"
|
|
285
|
+
}
|
|
286
|
+
type AxAIAnthropicConfig = AxModelConfig & {
|
|
287
|
+
model: AxAIAnthropicModel;
|
|
288
|
+
};
|
|
289
|
+
type AxAIAnthropicChatRequestCacheParam = {
|
|
290
|
+
cache_control?: {
|
|
291
|
+
type: 'ephemeral';
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
type AxAIAnthropicChatRequest = {
|
|
295
|
+
model: string;
|
|
296
|
+
messages: ({
|
|
297
|
+
role: 'user';
|
|
298
|
+
content: string | (({
|
|
299
|
+
type: 'text';
|
|
300
|
+
text: string;
|
|
301
|
+
} & AxAIAnthropicChatRequestCacheParam) | ({
|
|
302
|
+
type: 'image';
|
|
303
|
+
source: {
|
|
304
|
+
type: 'base64';
|
|
305
|
+
media_type: string;
|
|
306
|
+
data: string;
|
|
307
|
+
};
|
|
308
|
+
} & AxAIAnthropicChatRequestCacheParam) | {
|
|
309
|
+
type: 'tool_result';
|
|
310
|
+
is_error?: boolean;
|
|
311
|
+
tool_use_id: string;
|
|
312
|
+
content: string | (({
|
|
313
|
+
type: 'text';
|
|
314
|
+
text: string;
|
|
315
|
+
} & AxAIAnthropicChatRequestCacheParam) | ({
|
|
316
|
+
type: 'image';
|
|
317
|
+
source: {
|
|
318
|
+
type: 'base64';
|
|
319
|
+
media_type: string;
|
|
320
|
+
data: string;
|
|
321
|
+
};
|
|
322
|
+
} & AxAIAnthropicChatRequestCacheParam))[];
|
|
323
|
+
})[];
|
|
324
|
+
} | {
|
|
325
|
+
role: 'assistant';
|
|
326
|
+
content: string | ({
|
|
327
|
+
type: 'text';
|
|
328
|
+
text: string;
|
|
329
|
+
} | {
|
|
330
|
+
type: 'tool_use';
|
|
331
|
+
id: string;
|
|
332
|
+
name: string;
|
|
333
|
+
input: object;
|
|
334
|
+
})[];
|
|
335
|
+
})[];
|
|
336
|
+
tools?: ({
|
|
337
|
+
name: string;
|
|
338
|
+
description: string;
|
|
339
|
+
input_schema?: object;
|
|
340
|
+
} & AxAIAnthropicChatRequestCacheParam)[];
|
|
341
|
+
tool_choice?: {
|
|
342
|
+
type: 'auto' | 'any';
|
|
343
|
+
} | {
|
|
344
|
+
type: 'tool';
|
|
345
|
+
name?: string;
|
|
346
|
+
};
|
|
347
|
+
max_tokens?: number;
|
|
348
|
+
stop_sequences?: string[];
|
|
349
|
+
stream?: boolean;
|
|
350
|
+
system?: string | ({
|
|
351
|
+
type: 'text';
|
|
352
|
+
text: string;
|
|
353
|
+
} & AxAIAnthropicChatRequestCacheParam)[];
|
|
354
|
+
temperature?: number;
|
|
355
|
+
top_p?: number;
|
|
356
|
+
top_k?: number;
|
|
357
|
+
metadata?: {
|
|
358
|
+
user_id: string;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
type AxAIAnthropicChatResponse = {
|
|
362
|
+
id: string;
|
|
363
|
+
type: 'message';
|
|
364
|
+
role: 'assistant';
|
|
365
|
+
content: ({
|
|
366
|
+
type: 'text';
|
|
367
|
+
text: string;
|
|
368
|
+
} | {
|
|
369
|
+
id: string;
|
|
370
|
+
name: string;
|
|
371
|
+
type: 'tool_use';
|
|
372
|
+
input?: string;
|
|
373
|
+
})[];
|
|
374
|
+
model: string;
|
|
375
|
+
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use';
|
|
376
|
+
stop_sequence?: string;
|
|
377
|
+
usage: {
|
|
378
|
+
input_tokens: number;
|
|
379
|
+
output_tokens: number;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
type AxAIAnthropicChatError = {
|
|
383
|
+
type: 'error';
|
|
384
|
+
error: {
|
|
385
|
+
type: 'authentication_error';
|
|
386
|
+
message: string;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
interface AxAIAnthropicMessageStartEvent {
|
|
390
|
+
type: 'message_start';
|
|
391
|
+
message: {
|
|
392
|
+
id: string;
|
|
393
|
+
type: 'message';
|
|
394
|
+
role: 'assistant';
|
|
395
|
+
content: [];
|
|
396
|
+
model: string;
|
|
397
|
+
stop_reason: null | string;
|
|
398
|
+
stop_sequence: null | string;
|
|
399
|
+
usage: {
|
|
400
|
+
input_tokens: number;
|
|
401
|
+
output_tokens: number;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
interface AxAIAnthropicContentBlockStartEvent {
|
|
406
|
+
index: number;
|
|
407
|
+
type: 'content_block_start';
|
|
408
|
+
content_block: {
|
|
409
|
+
type: 'text';
|
|
410
|
+
text: string;
|
|
411
|
+
} | {
|
|
412
|
+
type: 'tool_use';
|
|
413
|
+
id: string;
|
|
414
|
+
name: string;
|
|
415
|
+
input: object;
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
interface AxAIAnthropicContentBlockDeltaEvent {
|
|
419
|
+
index: number;
|
|
420
|
+
type: 'content_block_delta';
|
|
421
|
+
delta: {
|
|
422
|
+
type: 'text_delta';
|
|
423
|
+
text: string;
|
|
424
|
+
} | {
|
|
425
|
+
type: 'input_json_delta';
|
|
426
|
+
partial_json: string;
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
interface AxAIAnthropicContentBlockStopEvent {
|
|
430
|
+
type: 'content_block_stop';
|
|
431
|
+
index: number;
|
|
432
|
+
}
|
|
433
|
+
interface AxAIAnthropicMessageDeltaEvent {
|
|
434
|
+
type: 'message_delta';
|
|
435
|
+
delta: {
|
|
436
|
+
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | null;
|
|
437
|
+
stop_sequence: string | null;
|
|
438
|
+
};
|
|
439
|
+
usage: {
|
|
440
|
+
output_tokens: number;
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
interface AxAIAnthropicMessageStopEvent {
|
|
444
|
+
type: 'message_stop';
|
|
445
|
+
}
|
|
446
|
+
interface AxAIAnthropicPingEvent {
|
|
447
|
+
type: 'ping';
|
|
448
|
+
}
|
|
449
|
+
interface AxAIAnthropicErrorEvent {
|
|
450
|
+
type: 'error';
|
|
451
|
+
error: {
|
|
452
|
+
type: 'overloaded_error';
|
|
453
|
+
message: string;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
type AxAIAnthropicChatResponseDelta = AxAIAnthropicMessageStartEvent | AxAIAnthropicContentBlockStartEvent | AxAIAnthropicContentBlockDeltaEvent | AxAIAnthropicContentBlockStopEvent | AxAIAnthropicMessageDeltaEvent | AxAIAnthropicMessageStopEvent | AxAIAnthropicPingEvent | AxAIAnthropicErrorEvent;
|
|
457
|
+
|
|
458
|
+
interface AxAIAnthropicArgs {
|
|
459
|
+
name: 'anthropic';
|
|
460
|
+
apiKey: string;
|
|
461
|
+
config?: Readonly<Partial<AxAIAnthropicConfig>>;
|
|
462
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
463
|
+
modelMap?: Record<string, AxAIAnthropicModel | string>;
|
|
464
|
+
}
|
|
465
|
+
declare class AxAIAnthropic extends AxBaseAI<AxAIAnthropicChatRequest, unknown, AxAIAnthropicChatResponse, AxAIAnthropicChatResponseDelta, unknown> {
|
|
466
|
+
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAIAnthropicArgs, 'name'>>);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
declare enum AxAIOpenAIModel {
|
|
470
|
+
O1Preview = "o1-preview",
|
|
471
|
+
O1Mini = "o1-mini",
|
|
472
|
+
GPT4 = "gpt-4",
|
|
473
|
+
GPT4O = "gpt-4o",
|
|
474
|
+
GPT4OMini = "gpt-4o-mini",
|
|
475
|
+
GPT4ChatGPT4O = "chatgpt-4o-latest",
|
|
476
|
+
GPT4Turbo = "gpt-4-turbo",
|
|
477
|
+
GPT35Turbo = "gpt-3.5-turbo",
|
|
478
|
+
GPT35TurboInstruct = "gpt-3.5-turbo-instruct",
|
|
479
|
+
GPT35TextDavinci002 = "text-davinci-002",
|
|
480
|
+
GPT3TextBabbage002 = "text-babbage-002",
|
|
481
|
+
GPT3TextAda001 = "text-ada-001"
|
|
482
|
+
}
|
|
483
|
+
declare enum AxAIOpenAIEmbedModel {
|
|
484
|
+
TextEmbeddingAda002 = "text-embedding-ada-002",
|
|
485
|
+
TextEmbedding3Small = "text-embedding-3-small",
|
|
486
|
+
TextEmbedding3Large = "text-embedding-3-large"
|
|
487
|
+
}
|
|
488
|
+
type AxAIOpenAIConfig = Omit<AxModelConfig, 'topK'> & {
|
|
489
|
+
model: AxAIOpenAIModel | string;
|
|
490
|
+
embedModel?: AxAIOpenAIEmbedModel | string;
|
|
491
|
+
user?: string;
|
|
492
|
+
responseFormat?: 'json_object';
|
|
493
|
+
bestOf?: number;
|
|
494
|
+
logitBias?: Map<string, number>;
|
|
495
|
+
suffix?: string | null;
|
|
496
|
+
stop?: string[];
|
|
497
|
+
logprobs?: number;
|
|
498
|
+
echo?: boolean;
|
|
499
|
+
dimensions?: number;
|
|
500
|
+
};
|
|
501
|
+
type AxAIOpenAILogprob = {
|
|
502
|
+
tokens: string[];
|
|
503
|
+
token_logprobs: number[];
|
|
504
|
+
top_logprobs: Map<string, number>;
|
|
505
|
+
text_offset: number[];
|
|
506
|
+
};
|
|
507
|
+
type AxAIOpenAIUsage = {
|
|
508
|
+
prompt_tokens: number;
|
|
509
|
+
completion_tokens: number;
|
|
510
|
+
total_tokens: number;
|
|
511
|
+
};
|
|
512
|
+
interface AxAIOpenAIResponseDelta<T> {
|
|
513
|
+
id: string;
|
|
514
|
+
object: string;
|
|
515
|
+
created: number;
|
|
516
|
+
model: string;
|
|
517
|
+
choices: {
|
|
518
|
+
index: number;
|
|
519
|
+
delta: T;
|
|
520
|
+
finish_reason: 'stop' | 'length' | 'content_filter' | 'tool_calls';
|
|
521
|
+
}[];
|
|
522
|
+
usage?: AxAIOpenAIUsage;
|
|
523
|
+
system_fingerprint: string;
|
|
524
|
+
}
|
|
525
|
+
type AxAIOpenAIChatRequest = {
|
|
526
|
+
model: string;
|
|
527
|
+
messages: ({
|
|
528
|
+
role: 'system';
|
|
529
|
+
content: string;
|
|
530
|
+
} | {
|
|
531
|
+
role: 'user';
|
|
532
|
+
content: string | ({
|
|
533
|
+
type: 'text';
|
|
534
|
+
text: string;
|
|
535
|
+
} | {
|
|
536
|
+
type: 'image_url';
|
|
537
|
+
image_url: {
|
|
538
|
+
url: string;
|
|
539
|
+
details?: 'high' | 'low' | 'auto';
|
|
540
|
+
};
|
|
541
|
+
} | {
|
|
542
|
+
type: 'input_audio';
|
|
543
|
+
input_audio: {
|
|
544
|
+
data: string;
|
|
545
|
+
format?: 'wav';
|
|
546
|
+
};
|
|
547
|
+
})[];
|
|
548
|
+
name?: string;
|
|
549
|
+
} | {
|
|
550
|
+
role: 'assistant';
|
|
551
|
+
content: string;
|
|
552
|
+
name?: string;
|
|
553
|
+
tool_calls?: {
|
|
554
|
+
type: 'function';
|
|
555
|
+
function: {
|
|
556
|
+
name: string;
|
|
557
|
+
arguments?: string;
|
|
558
|
+
};
|
|
559
|
+
}[];
|
|
560
|
+
} | {
|
|
561
|
+
role: 'tool';
|
|
562
|
+
content: string;
|
|
563
|
+
tool_call_id: string;
|
|
564
|
+
})[];
|
|
565
|
+
tools?: {
|
|
566
|
+
type: 'function';
|
|
567
|
+
function: {
|
|
568
|
+
name: string;
|
|
569
|
+
description: string;
|
|
570
|
+
parameters?: object;
|
|
571
|
+
};
|
|
572
|
+
}[];
|
|
573
|
+
tool_choice?: 'none' | 'auto' | 'required' | {
|
|
574
|
+
type: 'function';
|
|
575
|
+
function: {
|
|
576
|
+
name: string;
|
|
577
|
+
};
|
|
578
|
+
};
|
|
579
|
+
response_format?: {
|
|
580
|
+
type: string;
|
|
581
|
+
};
|
|
582
|
+
max_tokens: number;
|
|
583
|
+
temperature?: number;
|
|
584
|
+
top_p?: number;
|
|
585
|
+
n?: number;
|
|
586
|
+
stream?: boolean;
|
|
587
|
+
stop?: readonly string[];
|
|
588
|
+
presence_penalty?: number;
|
|
589
|
+
frequency_penalty?: number;
|
|
590
|
+
logit_bias?: Map<string, number>;
|
|
591
|
+
user?: string;
|
|
592
|
+
organization?: string;
|
|
593
|
+
};
|
|
594
|
+
type AxAIOpenAIChatResponse = {
|
|
595
|
+
id: string;
|
|
596
|
+
object: 'chat.completion';
|
|
597
|
+
created: number;
|
|
598
|
+
model: string;
|
|
599
|
+
choices: {
|
|
600
|
+
index: number;
|
|
601
|
+
message: {
|
|
602
|
+
role: string;
|
|
603
|
+
content: string;
|
|
604
|
+
tool_calls?: {
|
|
605
|
+
id: string;
|
|
606
|
+
type: 'function';
|
|
607
|
+
function: {
|
|
608
|
+
name: string;
|
|
609
|
+
arguments: string;
|
|
610
|
+
};
|
|
611
|
+
}[];
|
|
612
|
+
};
|
|
613
|
+
finish_reason: 'stop' | 'length' | 'content_filter' | 'tool_calls';
|
|
614
|
+
}[];
|
|
615
|
+
usage?: AxAIOpenAIUsage;
|
|
616
|
+
error?: {
|
|
617
|
+
message: string;
|
|
618
|
+
type: string;
|
|
619
|
+
param: string;
|
|
620
|
+
code: number;
|
|
621
|
+
};
|
|
622
|
+
system_fingerprint: string;
|
|
623
|
+
};
|
|
624
|
+
type AxAIOpenAIChatResponseDelta = AxAIOpenAIResponseDelta<{
|
|
625
|
+
content: string;
|
|
626
|
+
role?: string;
|
|
627
|
+
tool_calls?: (NonNullable<AxAIOpenAIChatResponse['choices'][0]['message']['tool_calls']>[0] & {
|
|
628
|
+
index: number;
|
|
629
|
+
})[];
|
|
630
|
+
}>;
|
|
631
|
+
type AxAIOpenAIEmbedRequest = {
|
|
632
|
+
input: readonly string[];
|
|
633
|
+
model: string;
|
|
634
|
+
dimensions?: number;
|
|
635
|
+
user?: string;
|
|
636
|
+
};
|
|
637
|
+
type AxAIOpenAIEmbedResponse = {
|
|
638
|
+
model: string;
|
|
639
|
+
data: {
|
|
640
|
+
embedding: readonly number[];
|
|
641
|
+
index: number;
|
|
642
|
+
}[];
|
|
643
|
+
usage: AxAIOpenAIUsage;
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
interface AxAIOpenAIArgs {
|
|
647
|
+
name: 'openai';
|
|
648
|
+
apiKey: string;
|
|
649
|
+
apiURL?: string;
|
|
650
|
+
config?: Readonly<Partial<AxAIOpenAIConfig>>;
|
|
651
|
+
options?: Readonly<AxAIServiceOptions & {
|
|
652
|
+
streamingUsage?: boolean;
|
|
653
|
+
}>;
|
|
654
|
+
modelInfo?: Readonly<AxModelInfo[]>;
|
|
655
|
+
modelMap?: Record<string, AxAIOpenAIModel | AxAIOpenAIEmbedModel | string>;
|
|
656
|
+
}
|
|
657
|
+
declare class AxAIOpenAI extends AxBaseAI<AxAIOpenAIChatRequest, AxAIOpenAIEmbedRequest, AxAIOpenAIChatResponse, AxAIOpenAIChatResponseDelta, AxAIOpenAIEmbedResponse> {
|
|
658
|
+
constructor({ apiKey, config, options, apiURL, modelInfo, modelMap, }: Readonly<Omit<AxAIOpenAIArgs, 'name'>>);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
interface AxAIAzureOpenAIArgs {
|
|
662
|
+
name: 'azure-openai';
|
|
663
|
+
apiKey: string;
|
|
664
|
+
resourceName: string;
|
|
665
|
+
deploymentName: string;
|
|
666
|
+
version?: string;
|
|
667
|
+
config?: Readonly<Partial<AxAIOpenAIConfig>>;
|
|
668
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
669
|
+
modelMap?: Record<string, AxAIOpenAIModel | AxAIOpenAIEmbedModel>;
|
|
670
|
+
}
|
|
671
|
+
declare class AxAIAzureOpenAI extends AxAIOpenAI {
|
|
672
|
+
constructor({ apiKey, resourceName, deploymentName, version, config, options, modelMap, }: Readonly<Omit<AxAIAzureOpenAIArgs, 'name'>>);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Cohere: Models for text generation
|
|
677
|
+
*/
|
|
678
|
+
declare enum AxAICohereModel {
|
|
679
|
+
CommandRPlus = "command-r-plus",
|
|
680
|
+
CommandR = "command-r",
|
|
681
|
+
Command = "command",
|
|
682
|
+
CommandLight = "command-light"
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Cohere: Models for use in embeddings
|
|
686
|
+
*/
|
|
687
|
+
declare enum AxAICohereEmbedModel {
|
|
688
|
+
EmbedEnglishV30 = "embed-english-v3.0",
|
|
689
|
+
EmbedEnglishLightV30 = "embed-english-light-v3.0",
|
|
690
|
+
EmbedMultiLingualV30 = "embed-multilingual-v3.0",
|
|
691
|
+
EmbedMultiLingualLightV30 = "embed-multilingual-light-v3.0"
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Cohere: Model options for text generation
|
|
695
|
+
*/
|
|
696
|
+
type AxAICohereConfig = AxModelConfig & {
|
|
697
|
+
model: AxAICohereModel;
|
|
698
|
+
embedModel?: AxAICohereEmbedModel;
|
|
699
|
+
};
|
|
700
|
+
type AxAICohereChatResponseToolCalls = {
|
|
701
|
+
name: string;
|
|
702
|
+
parameters?: object;
|
|
703
|
+
}[];
|
|
704
|
+
type AxAICohereChatRequestToolResults = {
|
|
705
|
+
call: AxAICohereChatResponseToolCalls[0];
|
|
706
|
+
outputs: object[];
|
|
707
|
+
}[];
|
|
708
|
+
type AxAICohereChatRequest = {
|
|
709
|
+
message?: string;
|
|
710
|
+
preamble?: string;
|
|
711
|
+
chat_history: ({
|
|
712
|
+
role: 'CHATBOT';
|
|
713
|
+
message: string;
|
|
714
|
+
tool_calls?: AxAICohereChatResponseToolCalls;
|
|
715
|
+
} | {
|
|
716
|
+
role: 'SYSTEM';
|
|
717
|
+
message: string;
|
|
718
|
+
} | {
|
|
719
|
+
role: 'USER';
|
|
720
|
+
message: string;
|
|
721
|
+
} | {
|
|
722
|
+
role: 'TOOL';
|
|
723
|
+
message?: string;
|
|
724
|
+
tool_results: AxAICohereChatRequestToolResults;
|
|
725
|
+
})[];
|
|
726
|
+
model: AxAICohereModel | string;
|
|
727
|
+
max_tokens?: number;
|
|
728
|
+
temperature?: number;
|
|
729
|
+
k?: number;
|
|
730
|
+
p?: number;
|
|
731
|
+
frequency_penalty?: number;
|
|
732
|
+
presence_penalty?: number;
|
|
733
|
+
end_sequences?: readonly string[];
|
|
734
|
+
stop_sequences?: string[];
|
|
735
|
+
tools?: {
|
|
736
|
+
name: string;
|
|
737
|
+
description: string;
|
|
738
|
+
parameter_definitions: Record<string, {
|
|
739
|
+
description: string;
|
|
740
|
+
type: string;
|
|
741
|
+
required: boolean;
|
|
742
|
+
}>;
|
|
743
|
+
}[];
|
|
744
|
+
tool_results?: AxAICohereChatRequestToolResults;
|
|
745
|
+
};
|
|
746
|
+
type AxAICohereChatResponse = {
|
|
747
|
+
response_id: string;
|
|
748
|
+
meta: {
|
|
749
|
+
billed_units: {
|
|
750
|
+
input_tokens: number;
|
|
751
|
+
output_tokens: number;
|
|
752
|
+
};
|
|
753
|
+
};
|
|
754
|
+
generation_id: string;
|
|
755
|
+
text: string;
|
|
756
|
+
finish_reason: 'COMPLETE' | 'ERROR' | 'ERROR_TOXIC' | 'ERROR_LIMIT' | 'USER_CANCEL' | 'MAX_TOKENS';
|
|
757
|
+
tool_calls: AxAICohereChatResponseToolCalls;
|
|
758
|
+
};
|
|
759
|
+
type AxAICohereChatResponseDelta = AxAICohereChatResponse & {
|
|
760
|
+
event_type: 'stream-start' | 'text-generation' | 'tool-calls-generation' | 'stream-end';
|
|
761
|
+
};
|
|
762
|
+
type AxAICohereEmbedRequest = {
|
|
763
|
+
texts: readonly string[];
|
|
764
|
+
model: AxAICohereModel | string;
|
|
765
|
+
truncate: string;
|
|
766
|
+
};
|
|
767
|
+
type AxAICohereEmbedResponse = {
|
|
768
|
+
id: string;
|
|
769
|
+
texts: string[];
|
|
770
|
+
model: string;
|
|
771
|
+
embeddings: number[][];
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
interface AxAICohereArgs {
|
|
775
|
+
name: 'cohere';
|
|
776
|
+
apiKey: string;
|
|
777
|
+
config?: Readonly<Partial<AxAICohereConfig>>;
|
|
778
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
779
|
+
modelMap?: Record<string, AxAICohereModel | AxAICohereEmbedModel | string>;
|
|
780
|
+
}
|
|
781
|
+
declare class AxAICohere extends AxBaseAI<AxAICohereChatRequest, AxAICohereEmbedRequest, AxAICohereChatResponse, AxAICohereChatResponseDelta, AxAICohereEmbedResponse> {
|
|
782
|
+
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAICohereArgs, 'name'>>);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* DeepSeek: Models for text generation
|
|
787
|
+
*/
|
|
788
|
+
declare enum AxAIDeepSeekModel {
|
|
789
|
+
DeepSeekChat = "deepseek-chat",
|
|
790
|
+
DeepSeekCoder = "deepseek-coder"
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
type DeepSeekConfig = AxAIOpenAIConfig;
|
|
794
|
+
interface AxAIDeepSeekArgs {
|
|
795
|
+
name: 'deepseek';
|
|
796
|
+
apiKey: string;
|
|
797
|
+
config?: Readonly<Partial<DeepSeekConfig>>;
|
|
798
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
799
|
+
modelMap?: Record<string, AxAIDeepSeekModel | string>;
|
|
800
|
+
}
|
|
801
|
+
declare class AxAIDeepSeek extends AxAIOpenAI {
|
|
802
|
+
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAIDeepSeekArgs, 'name'>>);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
declare enum AxAIGoogleGeminiModel {
|
|
806
|
+
Gemini1Pro = "gemini-1.0-pro",
|
|
807
|
+
Gemini15Flash = "gemini-1.5-flash",
|
|
808
|
+
Gemini15Flash8B = "gemini-1.5-flash-8b",
|
|
809
|
+
Gemini15Pro = "gemini-1.5-pro",
|
|
810
|
+
Gemma2 = "gemma-2-27b-it",
|
|
811
|
+
AQA = "aqa"
|
|
812
|
+
}
|
|
813
|
+
declare enum AxAIGoogleGeminiEmbedModel {
|
|
814
|
+
TextEmbedding004 = "text-embedding-004"
|
|
815
|
+
}
|
|
816
|
+
declare enum AxAIGoogleGeminiSafetyCategory {
|
|
817
|
+
HarmCategoryHarassment = "HARM_CATEGORY_HARASSMENT",
|
|
818
|
+
HarmCategoryHateSpeech = "HARM_CATEGORY_HATE_SPEECH",
|
|
819
|
+
HarmCategorySexuallyExplicit = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
820
|
+
HarmCategoryDangerousContent = "HARM_CATEGORY_DANGEROUS_CONTENT"
|
|
821
|
+
}
|
|
822
|
+
declare enum AxAIGoogleGeminiSafetyThreshold {
|
|
823
|
+
BlockNone = "BLOCK_NONE",
|
|
824
|
+
BlockOnlyHigh = "BLOCK_ONLY_HIGH",
|
|
825
|
+
BlockMediumAndAbove = "BLOCK_MEDIUM_AND_ABOVE",
|
|
826
|
+
BlockLowAndAbove = "BLOCK_LOW_AND_ABOVE",
|
|
827
|
+
BlockDefault = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"
|
|
828
|
+
}
|
|
829
|
+
type AxAIGoogleGeminiContent = {
|
|
830
|
+
role: 'user';
|
|
831
|
+
parts: ({
|
|
832
|
+
text: string;
|
|
833
|
+
} | {
|
|
834
|
+
inlineData: {
|
|
835
|
+
mimeType: string;
|
|
836
|
+
data: string;
|
|
837
|
+
};
|
|
838
|
+
} | {
|
|
839
|
+
fileData: {
|
|
840
|
+
mimeType: string;
|
|
841
|
+
fileUri: string;
|
|
842
|
+
};
|
|
843
|
+
})[];
|
|
844
|
+
} | {
|
|
845
|
+
role: 'model';
|
|
846
|
+
parts: {
|
|
847
|
+
text: string;
|
|
848
|
+
}[] | {
|
|
849
|
+
functionCall: {
|
|
850
|
+
name: string;
|
|
851
|
+
args: object;
|
|
852
|
+
};
|
|
853
|
+
}[];
|
|
854
|
+
} | {
|
|
855
|
+
role: 'function';
|
|
856
|
+
parts: {
|
|
857
|
+
functionResponse: {
|
|
858
|
+
name: string;
|
|
859
|
+
response: object;
|
|
860
|
+
};
|
|
861
|
+
}[];
|
|
862
|
+
};
|
|
863
|
+
type AxAIGoogleGeminiToolFunctionDeclaration = {
|
|
864
|
+
name: string;
|
|
865
|
+
description?: string;
|
|
866
|
+
parameters?: object;
|
|
867
|
+
};
|
|
868
|
+
type AxAIGoogleGeminiToolGoogleSearchRetrieval = {
|
|
869
|
+
dynamic_retrieval_config: {
|
|
870
|
+
mode?: 'MODE_DYNAMIC';
|
|
871
|
+
dynamic_threshold?: number;
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
type AxAIGoogleGeminiTool = {
|
|
875
|
+
function_declarations?: AxAIGoogleGeminiToolFunctionDeclaration[];
|
|
876
|
+
code_execution?: object;
|
|
877
|
+
google_search_retrieval?: AxAIGoogleGeminiToolGoogleSearchRetrieval;
|
|
878
|
+
};
|
|
879
|
+
type AxAIGoogleGeminiToolConfig = {
|
|
880
|
+
function_calling_config: {
|
|
881
|
+
mode: 'ANY' | 'NONE' | 'AUTO';
|
|
882
|
+
allowed_function_names?: string[];
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
type AxAIGoogleGeminiGenerationConfig = {
|
|
886
|
+
temperature?: number;
|
|
887
|
+
topP?: number;
|
|
888
|
+
topK?: number;
|
|
889
|
+
candidateCount?: number;
|
|
890
|
+
maxOutputTokens?: number;
|
|
891
|
+
stopSequences?: readonly string[];
|
|
892
|
+
};
|
|
893
|
+
type AxAIGoogleGeminiSafetySettings = {
|
|
894
|
+
category: AxAIGoogleGeminiSafetyCategory;
|
|
895
|
+
threshold: AxAIGoogleGeminiSafetyThreshold;
|
|
896
|
+
}[];
|
|
897
|
+
type AxAIGoogleGeminiChatRequest = {
|
|
898
|
+
contents: AxAIGoogleGeminiContent[];
|
|
899
|
+
tools?: AxAIGoogleGeminiTool[];
|
|
900
|
+
toolConfig?: AxAIGoogleGeminiToolConfig;
|
|
901
|
+
systemInstruction?: AxAIGoogleGeminiContent;
|
|
902
|
+
generationConfig: AxAIGoogleGeminiGenerationConfig;
|
|
903
|
+
safetySettings?: AxAIGoogleGeminiSafetySettings;
|
|
904
|
+
};
|
|
905
|
+
type AxAIGoogleGeminiChatResponse = {
|
|
906
|
+
candidates: {
|
|
907
|
+
content: AxAIGoogleGeminiContent;
|
|
908
|
+
finishReason: 'STOP' | 'MAX_TOKENS' | 'SAFETY' | 'RECITATION' | 'OTHER' | 'MALFORMED_FUNCTION_CALL';
|
|
909
|
+
citationMetadata: {
|
|
910
|
+
citations: {
|
|
911
|
+
startIndex: number;
|
|
912
|
+
endIndex: number;
|
|
913
|
+
uri: string;
|
|
914
|
+
title: string;
|
|
915
|
+
license: string;
|
|
916
|
+
publicationDate: {
|
|
917
|
+
year: number;
|
|
918
|
+
month: number;
|
|
919
|
+
day: number;
|
|
920
|
+
};
|
|
921
|
+
}[];
|
|
922
|
+
};
|
|
923
|
+
}[];
|
|
924
|
+
usageMetadata: {
|
|
925
|
+
promptTokenCount: number;
|
|
926
|
+
candidatesTokenCount: number;
|
|
927
|
+
totalTokenCount: number;
|
|
928
|
+
};
|
|
929
|
+
};
|
|
930
|
+
type AxAIGoogleGeminiChatResponseDelta = AxAIGoogleGeminiChatResponse;
|
|
931
|
+
/**
|
|
932
|
+
* AxAIGoogleGeminiConfig: Configuration options for Google Gemini API
|
|
933
|
+
*/
|
|
934
|
+
type AxAIGoogleGeminiConfig = AxModelConfig & {
|
|
935
|
+
model: AxAIGoogleGeminiModel | string;
|
|
936
|
+
embedModel?: AxAIGoogleGeminiEmbedModel;
|
|
937
|
+
safetySettings?: AxAIGoogleGeminiSafetySettings;
|
|
938
|
+
};
|
|
939
|
+
/**
|
|
940
|
+
* AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.
|
|
941
|
+
*/
|
|
942
|
+
type AxAIGoogleGeminiBatchEmbedRequest = {
|
|
943
|
+
requests: {
|
|
944
|
+
model: string;
|
|
945
|
+
content: {
|
|
946
|
+
parts: {
|
|
947
|
+
text: string;
|
|
948
|
+
}[];
|
|
949
|
+
};
|
|
950
|
+
}[];
|
|
951
|
+
};
|
|
952
|
+
/**
|
|
953
|
+
* AxAIGoogleGeminiEmbedResponse: Structure for handling responses from the Google Gemini API embedding requests.
|
|
954
|
+
*/
|
|
955
|
+
type AxAIGoogleGeminiBatchEmbedResponse = {
|
|
956
|
+
embeddings: {
|
|
957
|
+
values: number[];
|
|
958
|
+
}[];
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
interface AxAIGoogleGeminiOptionsTools {
|
|
962
|
+
codeExecution?: boolean;
|
|
963
|
+
googleSearchRetrieval?: {
|
|
964
|
+
mode?: 'MODE_DYNAMIC';
|
|
965
|
+
dynamicThreshold?: number;
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
interface AxAIGoogleGeminiArgs {
|
|
969
|
+
name: 'google-gemini';
|
|
970
|
+
apiKey: string;
|
|
971
|
+
projectId?: string;
|
|
972
|
+
region?: string;
|
|
973
|
+
config?: Readonly<Partial<AxAIGoogleGeminiConfig>>;
|
|
974
|
+
options?: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>;
|
|
975
|
+
modelMap?: Record<string, AxAIGoogleGeminiModel | AxAIGoogleGeminiEmbedModel | string>;
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* AxAIGoogleGemini: AI Service
|
|
979
|
+
*/
|
|
980
|
+
declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse> {
|
|
981
|
+
constructor({ apiKey, projectId, region, config, options, modelMap, }: Readonly<Omit<AxAIGoogleGeminiArgs, 'name'>>);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
declare enum AxAIGroqModel {
|
|
985
|
+
Llama3_8B = "llama3-8b-8192",
|
|
986
|
+
Llama3_70B = "llama3-70b-8192",
|
|
987
|
+
Mixtral_8x7B = "mixtral-8x7b-32768",
|
|
988
|
+
Gemma_7B = "gemma-7b-it"
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
type AxAIGroqAIConfig = AxAIOpenAIConfig;
|
|
992
|
+
interface AxAIGroqArgs {
|
|
993
|
+
name: 'groq';
|
|
994
|
+
apiKey: string;
|
|
995
|
+
config?: Readonly<Partial<AxAIGroqAIConfig>>;
|
|
996
|
+
options?: Readonly<AxAIServiceOptions> & {
|
|
997
|
+
tokensPerMinute?: number;
|
|
998
|
+
};
|
|
999
|
+
modelMap?: Record<string, AxAIGroqModel>;
|
|
1000
|
+
}
|
|
1001
|
+
declare class AxAIGroq extends AxAIOpenAI {
|
|
1002
|
+
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAIGroqArgs, 'groq'>>);
|
|
1003
|
+
setOptions: (options: Readonly<AxAIServiceOptions>) => void;
|
|
1004
|
+
private newRateLimiter;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
declare enum AxAIHuggingFaceModel {
|
|
1008
|
+
MetaLlama270BChatHF = "meta-llama/Llama-2-70b-chat-hf"
|
|
1009
|
+
}
|
|
1010
|
+
type AxAIHuggingFaceConfig = AxModelConfig & {
|
|
1011
|
+
model: AxAIHuggingFaceModel;
|
|
1012
|
+
returnFullText?: boolean;
|
|
1013
|
+
doSample?: boolean;
|
|
1014
|
+
maxTime?: number;
|
|
1015
|
+
useCache?: boolean;
|
|
1016
|
+
waitForModel?: boolean;
|
|
1017
|
+
};
|
|
1018
|
+
type AxAIHuggingFaceRequest = {
|
|
1019
|
+
model: AxAIHuggingFaceModel | string;
|
|
1020
|
+
inputs: string;
|
|
1021
|
+
parameters: {
|
|
1022
|
+
max_new_tokens?: number;
|
|
1023
|
+
repetition_penalty?: number;
|
|
1024
|
+
temperature?: number;
|
|
1025
|
+
top_p?: number;
|
|
1026
|
+
top_k?: number;
|
|
1027
|
+
return_full_text?: boolean;
|
|
1028
|
+
num_return_sequences?: number;
|
|
1029
|
+
do_sample?: boolean;
|
|
1030
|
+
max_time?: number;
|
|
1031
|
+
};
|
|
1032
|
+
options?: {
|
|
1033
|
+
use_cache?: boolean;
|
|
1034
|
+
wait_for_model?: boolean;
|
|
1035
|
+
};
|
|
1036
|
+
};
|
|
1037
|
+
type AxAIHuggingFaceResponse = {
|
|
1038
|
+
generated_text: string;
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
interface AxAIHuggingFaceArgs {
|
|
1042
|
+
name: 'huggingface';
|
|
1043
|
+
apiKey: string;
|
|
1044
|
+
config?: Readonly<Partial<AxAIHuggingFaceConfig>>;
|
|
1045
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
1046
|
+
modelMap?: Record<string, AxAIHuggingFaceModel>;
|
|
1047
|
+
}
|
|
1048
|
+
declare class AxAIHuggingFace extends AxBaseAI<AxAIHuggingFaceRequest, unknown, AxAIHuggingFaceResponse, unknown, unknown> {
|
|
1049
|
+
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAIHuggingFaceArgs, 'name'>>);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
declare enum AxAIMistralModel {
|
|
1053
|
+
Mistral7B = "open-mistral-7b",
|
|
1054
|
+
Mistral8x7B = "open-mixtral-8x7b",
|
|
1055
|
+
MistralSmall = "mistral-small-latest",
|
|
1056
|
+
MistralNemo = "mistral-nemo-latest",
|
|
1057
|
+
MistralLarge = "mistral-large-latest",
|
|
1058
|
+
Codestral = "codestral-latest",
|
|
1059
|
+
OpenCodestralMamba = "open-codestral-mamba",
|
|
1060
|
+
OpenMistralNemo = "open-mistral-nemo-latest"
|
|
1061
|
+
}
|
|
1062
|
+
declare enum AxAIMistralEmbedModels {
|
|
1063
|
+
MistralEmbed = "mistral-embed"
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
type MistralConfig = AxAIOpenAIConfig;
|
|
1067
|
+
interface AxAIMistralArgs {
|
|
1068
|
+
name: 'mistral';
|
|
1069
|
+
apiKey: string;
|
|
1070
|
+
config?: Readonly<Partial<MistralConfig>>;
|
|
1071
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
1072
|
+
modelMap?: Record<string, AxAIMistralModel | AxAIMistralEmbedModels | string>;
|
|
1073
|
+
}
|
|
1074
|
+
declare class AxAIMistral extends AxAIOpenAI {
|
|
1075
|
+
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAIMistralArgs, 'name'>>);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
type AxAIOllamaAIConfig = AxAIOpenAIConfig;
|
|
1079
|
+
type AxAIOllamaArgs = {
|
|
1080
|
+
name: 'ollama';
|
|
1081
|
+
model?: string;
|
|
1082
|
+
embedModel?: string;
|
|
1083
|
+
url?: string;
|
|
1084
|
+
apiKey?: string;
|
|
1085
|
+
config?: Readonly<Partial<AxAIOllamaAIConfig>>;
|
|
1086
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
1087
|
+
modelMap?: Record<string, string>;
|
|
1088
|
+
};
|
|
1089
|
+
/**
|
|
1090
|
+
* OllamaAI: AI Service
|
|
1091
|
+
*/
|
|
1092
|
+
declare class AxAIOllama extends AxAIOpenAI {
|
|
1093
|
+
constructor({ apiKey, url, config, options, modelMap, }: Readonly<Omit<AxAIOllamaArgs, 'name'>>);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
declare enum AxAIRekaModel {
|
|
1097
|
+
RekaCore = "reka-core",
|
|
1098
|
+
RekaFlash = "reka-flash",
|
|
1099
|
+
RekaEdge = "reka-edge"
|
|
1100
|
+
}
|
|
1101
|
+
type AxAIRekaConfig = Omit<AxModelConfig, 'topK'> & {
|
|
1102
|
+
model: AxAIRekaModel | string;
|
|
1103
|
+
stop?: readonly string[];
|
|
1104
|
+
useSearchEngine?: boolean;
|
|
1105
|
+
};
|
|
1106
|
+
type AxAIRekaUsage = {
|
|
1107
|
+
input_tokens: number;
|
|
1108
|
+
output_tokens: number;
|
|
1109
|
+
};
|
|
1110
|
+
type AxAIRekaChatRequest = {
|
|
1111
|
+
model: string;
|
|
1112
|
+
messages: ({
|
|
1113
|
+
role: 'user';
|
|
1114
|
+
content: string | {
|
|
1115
|
+
type: 'text';
|
|
1116
|
+
text: string;
|
|
1117
|
+
}[];
|
|
1118
|
+
} | {
|
|
1119
|
+
role: 'assistant';
|
|
1120
|
+
content: string | {
|
|
1121
|
+
type: 'text';
|
|
1122
|
+
text: string;
|
|
1123
|
+
}[];
|
|
1124
|
+
})[];
|
|
1125
|
+
usage?: AxAIRekaUsage;
|
|
1126
|
+
response_format?: {
|
|
1127
|
+
type: string;
|
|
1128
|
+
};
|
|
1129
|
+
max_tokens: number;
|
|
1130
|
+
temperature?: number;
|
|
1131
|
+
top_p?: number;
|
|
1132
|
+
top_k?: number;
|
|
1133
|
+
stream?: boolean;
|
|
1134
|
+
stop?: readonly string[];
|
|
1135
|
+
presence_penalty?: number;
|
|
1136
|
+
frequency_penalty?: number;
|
|
1137
|
+
use_search_engine?: boolean;
|
|
1138
|
+
};
|
|
1139
|
+
type AxAIRekaChatResponse = {
|
|
1140
|
+
id: string;
|
|
1141
|
+
model: string;
|
|
1142
|
+
responses: {
|
|
1143
|
+
message: {
|
|
1144
|
+
content: string | {
|
|
1145
|
+
type: 'text';
|
|
1146
|
+
text: string;
|
|
1147
|
+
};
|
|
1148
|
+
};
|
|
1149
|
+
finish_reason: 'stop' | 'length' | 'context';
|
|
1150
|
+
}[];
|
|
1151
|
+
usage?: AxAIRekaUsage;
|
|
1152
|
+
};
|
|
1153
|
+
type AxAIRekaChatResponseDelta = {
|
|
1154
|
+
id: string;
|
|
1155
|
+
model: string;
|
|
1156
|
+
responses: {
|
|
1157
|
+
chunk: AxAIRekaChatResponse['responses'][0]['message'];
|
|
1158
|
+
finish_reason: AxAIRekaChatResponse['responses'][0]['finish_reason'];
|
|
1159
|
+
}[];
|
|
1160
|
+
usage?: AxAIRekaUsage;
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
interface AxAIRekaArgs {
|
|
1164
|
+
name: 'reka';
|
|
1165
|
+
apiKey: string;
|
|
1166
|
+
apiURL?: string;
|
|
1167
|
+
config?: Readonly<Partial<AxAIRekaConfig>>;
|
|
1168
|
+
options?: Readonly<AxAIServiceOptions & {
|
|
1169
|
+
streamingUsage?: boolean;
|
|
1170
|
+
}>;
|
|
1171
|
+
modelInfo?: Readonly<AxModelInfo[]>;
|
|
1172
|
+
modelMap?: Record<string, AxAIRekaModel | string>;
|
|
1173
|
+
}
|
|
1174
|
+
declare class AxAIReka extends AxBaseAI<AxAIRekaChatRequest, unknown, AxAIRekaChatResponse, AxAIRekaChatResponseDelta, unknown> {
|
|
1175
|
+
constructor({ apiKey, config, options, apiURL, modelInfo, modelMap, }: Readonly<Omit<AxAIRekaArgs, 'name'>>);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
type TogetherAIConfig = AxAIOpenAIConfig;
|
|
1179
|
+
interface AxAITogetherArgs {
|
|
1180
|
+
name: 'together';
|
|
1181
|
+
apiKey: string;
|
|
1182
|
+
config?: Readonly<Partial<TogetherAIConfig>>;
|
|
1183
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
1184
|
+
modelMap?: Record<string, string>;
|
|
1185
|
+
}
|
|
1186
|
+
declare class AxAITogether extends AxAIOpenAI {
|
|
1187
|
+
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAITogetherArgs, 'name'>>);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
type AxAIArgs = AxAIOpenAIArgs | AxAIAzureOpenAIArgs | AxAITogetherArgs | AxAIAnthropicArgs | AxAIGroqArgs | AxAIGoogleGeminiArgs | AxAICohereArgs | AxAIHuggingFaceArgs | AxAIMistralArgs | AxAIDeepSeekArgs | AxAIOllamaArgs | AxAIRekaArgs;
|
|
1191
|
+
type AxAIModels = AxAIOpenAIModel | AxAIAnthropicModel | AxAIGroqModel | AxAIGoogleGeminiModel | AxAICohereModel | AxAIHuggingFaceModel | AxAIMistralModel | AxAIDeepSeekModel | string;
|
|
1192
|
+
type AxAIEmbedModels = AxAIOpenAIEmbedModel | AxAIGoogleGeminiEmbedModel | AxAICohereEmbedModel | string;
|
|
1193
|
+
declare class AxAI implements AxAIService {
|
|
1194
|
+
private ai;
|
|
1195
|
+
constructor(options: Readonly<AxAIArgs>);
|
|
1196
|
+
getName(): string;
|
|
1197
|
+
getModelInfo(): Readonly<AxModelInfoWithProvider>;
|
|
1198
|
+
getEmbedModelInfo(): Readonly<AxModelInfoWithProvider> | undefined;
|
|
1199
|
+
getFeatures(model?: string): {
|
|
1200
|
+
functions: boolean;
|
|
1201
|
+
streaming: boolean;
|
|
1202
|
+
};
|
|
1203
|
+
getModelMap(): AxAIModelMap | undefined;
|
|
1204
|
+
getMetrics(): AxAIServiceMetrics;
|
|
1205
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1206
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
1207
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
interface AxAIMemory {
|
|
1211
|
+
add(result: Readonly<AxChatRequest['chatPrompt'] | AxChatRequest['chatPrompt'][0]>, sessionId?: string): void;
|
|
1212
|
+
addResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1213
|
+
updateResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1214
|
+
history(sessionId?: string): AxChatRequest['chatPrompt'];
|
|
1215
|
+
reset(sessionId?: string): void;
|
|
1216
|
+
getLast(sessionId?: string): AxChatRequest['chatPrompt'][0] | undefined;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
interface AxField {
|
|
1220
|
+
name: string;
|
|
1221
|
+
title?: string;
|
|
1222
|
+
description?: string;
|
|
1223
|
+
type?: {
|
|
1224
|
+
name: 'string' | 'number' | 'boolean' | 'json' | 'image' | 'audio' | 'date' | 'datetime' | 'class';
|
|
1225
|
+
isArray: boolean;
|
|
1226
|
+
classes?: string[];
|
|
1227
|
+
};
|
|
1228
|
+
isOptional?: boolean;
|
|
1229
|
+
}
|
|
1230
|
+
type AxIField = Omit<AxField, 'title'> & {
|
|
1231
|
+
title: string;
|
|
1232
|
+
};
|
|
1233
|
+
declare class AxSignature {
|
|
1234
|
+
private description?;
|
|
1235
|
+
private inputFields;
|
|
1236
|
+
private outputFields;
|
|
1237
|
+
private sigHash;
|
|
1238
|
+
private sigString;
|
|
1239
|
+
constructor(signature?: Readonly<AxSignature | string>);
|
|
1240
|
+
private parseParsedField;
|
|
1241
|
+
private parseField;
|
|
1242
|
+
setDescription: (desc: string) => void;
|
|
1243
|
+
addInputField: (field: Readonly<AxField>) => void;
|
|
1244
|
+
addOutputField: (field: Readonly<AxField>) => void;
|
|
1245
|
+
setInputFields: (fields: readonly AxField[]) => void;
|
|
1246
|
+
setOutputFields: (fields: readonly AxField[]) => void;
|
|
1247
|
+
getInputFields: () => Readonly<AxIField[]>;
|
|
1248
|
+
getOutputFields: () => Readonly<AxIField[]>;
|
|
1249
|
+
getDescription: () => string | undefined;
|
|
1250
|
+
private toTitle;
|
|
1251
|
+
toJSONSchema: () => AxFunctionJSONSchema;
|
|
1252
|
+
private updateHash;
|
|
1253
|
+
hash: () => string;
|
|
1254
|
+
toString: () => string;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
type AxFieldValue = string | string[] | number | boolean | object | null | undefined | {
|
|
1258
|
+
mimeType: string;
|
|
1259
|
+
data: string;
|
|
1260
|
+
} | {
|
|
1261
|
+
mimeType: string;
|
|
1262
|
+
data: string;
|
|
1263
|
+
}[] | {
|
|
1264
|
+
format?: 'wav';
|
|
1265
|
+
data: string;
|
|
1266
|
+
} | {
|
|
1267
|
+
format?: 'wav';
|
|
1268
|
+
data: string;
|
|
1269
|
+
}[];
|
|
1270
|
+
type AxGenIn = {
|
|
1271
|
+
[key: symbol]: AxFieldValue;
|
|
1272
|
+
};
|
|
1273
|
+
type AxGenOut = Record<string, AxFieldValue>;
|
|
1274
|
+
type AxProgramTrace = {
|
|
1275
|
+
trace: Record<string, AxFieldValue>;
|
|
1276
|
+
programId: string;
|
|
1277
|
+
};
|
|
1278
|
+
type AxProgramDemos = {
|
|
1279
|
+
traces: Record<string, AxFieldValue>[];
|
|
1280
|
+
programId: string;
|
|
1281
|
+
};
|
|
1282
|
+
type AxProgramExamples = AxProgramDemos | AxProgramDemos['traces'];
|
|
1283
|
+
type AxProgramForwardOptions = {
|
|
1284
|
+
maxCompletions?: number;
|
|
1285
|
+
maxRetries?: number;
|
|
1286
|
+
maxSteps?: number;
|
|
1287
|
+
mem?: AxAIMemory;
|
|
1288
|
+
ai?: AxAIService;
|
|
1289
|
+
modelConfig?: AxModelConfig;
|
|
1290
|
+
model?: string;
|
|
1291
|
+
sessionId?: string;
|
|
1292
|
+
traceId?: string | undefined;
|
|
1293
|
+
tracer?: Tracer;
|
|
1294
|
+
rateLimiter?: AxRateLimiterFunction;
|
|
1295
|
+
stream?: boolean;
|
|
1296
|
+
debug?: boolean;
|
|
1297
|
+
functions?: AxFunction[];
|
|
1298
|
+
functionCall?: AxChatRequest['functionCall'];
|
|
1299
|
+
stopFunction?: string;
|
|
1300
|
+
};
|
|
1301
|
+
interface AxTunable {
|
|
1302
|
+
setExamples: (examples: Readonly<AxProgramExamples>) => void;
|
|
1303
|
+
setId: (id: string) => void;
|
|
1304
|
+
setParentId: (parentId: string) => void;
|
|
1305
|
+
getTraces: () => AxProgramTrace[];
|
|
1306
|
+
setDemos: (demos: readonly AxProgramDemos[]) => void;
|
|
1307
|
+
}
|
|
1308
|
+
interface AxUsable {
|
|
1309
|
+
getUsage: () => AxProgramUsage[];
|
|
1310
|
+
resetUsage: () => void;
|
|
1311
|
+
}
|
|
1312
|
+
type AxProgramUsage = AxChatResponse['modelUsage'] & {
|
|
1313
|
+
ai: string;
|
|
1314
|
+
model: string;
|
|
1315
|
+
};
|
|
1316
|
+
interface AxProgramWithSignatureOptions {
|
|
1317
|
+
description?: string;
|
|
1318
|
+
}
|
|
1319
|
+
declare class AxProgramWithSignature<IN extends AxGenIn, OUT extends AxGenOut> implements AxTunable, AxUsable {
|
|
1320
|
+
protected signature: AxSignature;
|
|
1321
|
+
protected sigHash: string;
|
|
1322
|
+
protected examples?: Record<string, AxFieldValue>[];
|
|
1323
|
+
protected demos?: Record<string, AxFieldValue>[];
|
|
1324
|
+
protected trace?: Record<string, AxFieldValue>;
|
|
1325
|
+
protected usage: AxProgramUsage[];
|
|
1326
|
+
private key;
|
|
1327
|
+
private children;
|
|
1328
|
+
constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxProgramWithSignatureOptions>);
|
|
1329
|
+
getSignature(): AxSignature;
|
|
1330
|
+
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
1331
|
+
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1332
|
+
setId(id: string): void;
|
|
1333
|
+
setParentId(parentId: string): void;
|
|
1334
|
+
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
1335
|
+
private _setExamples;
|
|
1336
|
+
getTraces(): AxProgramTrace[];
|
|
1337
|
+
getUsage(): AxProgramUsage[];
|
|
1338
|
+
resetUsage(): void;
|
|
1339
|
+
setDemos(demos: readonly AxProgramDemos[]): void;
|
|
1340
|
+
}
|
|
1341
|
+
declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxTunable, AxUsable {
|
|
1342
|
+
protected trace?: Record<string, AxFieldValue>;
|
|
1343
|
+
protected usage: AxProgramUsage[];
|
|
1344
|
+
private key;
|
|
1345
|
+
private children;
|
|
1346
|
+
constructor();
|
|
1347
|
+
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
1348
|
+
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1349
|
+
setId(id: string): void;
|
|
1350
|
+
setParentId(parentId: string): void;
|
|
1351
|
+
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
1352
|
+
getTraces(): AxProgramTrace[];
|
|
1353
|
+
getUsage(): AxProgramUsage[];
|
|
1354
|
+
resetUsage(): void;
|
|
1355
|
+
setDemos(demos: readonly AxProgramDemos[]): void;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
interface AxAssertion {
|
|
1359
|
+
fn(values: Record<string, unknown>): boolean | undefined;
|
|
1360
|
+
message?: string;
|
|
1361
|
+
optional?: boolean;
|
|
1362
|
+
}
|
|
1363
|
+
interface AxStreamingAssertion {
|
|
1364
|
+
fieldName: string;
|
|
1365
|
+
fn(content: string, done?: boolean): boolean | undefined;
|
|
1366
|
+
message?: string;
|
|
1367
|
+
optional?: boolean;
|
|
1368
|
+
}
|
|
1369
|
+
declare class AxAssertionError extends Error {
|
|
1370
|
+
private values;
|
|
1371
|
+
private optional?;
|
|
1372
|
+
constructor({ message, values, optional, }: Readonly<{
|
|
1373
|
+
message: string;
|
|
1374
|
+
values: Record<string, unknown>;
|
|
1375
|
+
optional?: boolean;
|
|
1376
|
+
}>);
|
|
1377
|
+
getValue: () => Record<string, unknown>;
|
|
1378
|
+
getOptional: () => boolean | undefined;
|
|
1379
|
+
getFixingInstructions: (_sig: Readonly<AxSignature>) => {
|
|
1380
|
+
name: string;
|
|
1381
|
+
title: string;
|
|
1382
|
+
description: string;
|
|
1383
|
+
}[];
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
declare class AxMemory implements AxAIMemory {
|
|
1387
|
+
private data;
|
|
1388
|
+
private sdata;
|
|
1389
|
+
private limit;
|
|
1390
|
+
constructor(limit?: number);
|
|
1391
|
+
add(value: Readonly<AxChatRequest['chatPrompt'][0] | AxChatRequest['chatPrompt']>, sessionId?: string): void;
|
|
1392
|
+
addResult({ content, name, functionCalls }: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1393
|
+
updateResult({ content, name, functionCalls }: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1394
|
+
history(sessionId?: string): AxChatRequest['chatPrompt'];
|
|
1395
|
+
getLast(sessionId?: string): AxChatRequest['chatPrompt'][0] | undefined;
|
|
1396
|
+
reset(sessionId?: string): void;
|
|
1397
|
+
private get;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
type AxChatResponseFunctionCall = {
|
|
1401
|
+
id?: string;
|
|
1402
|
+
name: string;
|
|
1403
|
+
args: string;
|
|
1404
|
+
};
|
|
1405
|
+
type AxFunctionExec = {
|
|
1406
|
+
id?: string;
|
|
1407
|
+
result?: string;
|
|
1408
|
+
};
|
|
1409
|
+
declare class AxFunctionProcessor {
|
|
1410
|
+
private funcList;
|
|
1411
|
+
constructor(funcList: Readonly<AxFunction[]>);
|
|
1412
|
+
private executeFunction;
|
|
1413
|
+
execute: (func: Readonly<AxChatResponseFunctionCall>, options?: Readonly<AxAIServiceActionOptions>) => Promise<AxFunctionExec>;
|
|
1414
|
+
}
|
|
1415
|
+
type AxInputFunctionType = AxFunction[] | {
|
|
1416
|
+
toFunction: () => AxFunction;
|
|
1417
|
+
}[];
|
|
1418
|
+
|
|
1419
|
+
type Writeable<T> = {
|
|
1420
|
+
-readonly [P in keyof T]: T[P];
|
|
1421
|
+
};
|
|
1422
|
+
type AxChatRequestChatPrompt = Writeable<AxChatRequest['chatPrompt'][0]>;
|
|
1423
|
+
type ChatRequestUserMessage = Exclude<Extract<AxChatRequestChatPrompt, {
|
|
1424
|
+
role: 'user';
|
|
1425
|
+
}>['content'], string>;
|
|
1426
|
+
type AxFieldTemplateFn = (field: Readonly<AxField>, value: Readonly<AxFieldValue>) => ChatRequestUserMessage;
|
|
1427
|
+
declare class AxPromptTemplate {
|
|
1428
|
+
private sig;
|
|
1429
|
+
private fieldTemplates?;
|
|
1430
|
+
private task;
|
|
1431
|
+
constructor(sig: Readonly<AxSignature>, functions?: Readonly<AxInputFunctionType>, fieldTemplates?: Record<string, AxFieldTemplateFn>);
|
|
1432
|
+
render: <T extends Record<string, AxFieldValue>>(values: T, { examples, demos, }: Readonly<{
|
|
1433
|
+
skipSystemPrompt?: boolean;
|
|
1434
|
+
examples?: Record<string, AxFieldValue>[];
|
|
1435
|
+
demos?: Record<string, AxFieldValue>[];
|
|
1436
|
+
}>) => AxChatRequest["chatPrompt"];
|
|
1437
|
+
renderExtraFields: (extraFields: readonly AxIField[]) => string | ({
|
|
1438
|
+
type: "text";
|
|
1439
|
+
text: string;
|
|
1440
|
+
cache?: boolean;
|
|
1441
|
+
} | {
|
|
1442
|
+
type: "image";
|
|
1443
|
+
mimeType: string;
|
|
1444
|
+
image: string;
|
|
1445
|
+
details?: "high" | "low" | "auto";
|
|
1446
|
+
cache?: boolean;
|
|
1447
|
+
} | {
|
|
1448
|
+
type: "audio";
|
|
1449
|
+
data: string;
|
|
1450
|
+
format?: "wav";
|
|
1451
|
+
cache?: boolean;
|
|
1452
|
+
})[];
|
|
1453
|
+
private renderExamples;
|
|
1454
|
+
private renderDemos;
|
|
1455
|
+
private renderInputFields;
|
|
1456
|
+
private renderInField;
|
|
1457
|
+
private defaultRenderInField;
|
|
1458
|
+
private renderDescFields;
|
|
1459
|
+
private renderFields;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
interface AxGenOptions {
|
|
1463
|
+
maxCompletions?: number;
|
|
1464
|
+
maxRetries?: number;
|
|
1465
|
+
maxSteps?: number;
|
|
1466
|
+
mem?: AxAIMemory;
|
|
1467
|
+
tracer?: Tracer;
|
|
1468
|
+
rateLimiter?: AxRateLimiterFunction;
|
|
1469
|
+
stream?: boolean;
|
|
1470
|
+
debug?: boolean;
|
|
1471
|
+
description?: string;
|
|
1472
|
+
functions?: AxInputFunctionType;
|
|
1473
|
+
functionCall?: AxChatRequest['functionCall'];
|
|
1474
|
+
stopFunction?: string;
|
|
1475
|
+
promptTemplate?: typeof AxPromptTemplate;
|
|
1476
|
+
asserts?: AxAssertion[];
|
|
1477
|
+
streamingAsserts?: AxStreamingAssertion[];
|
|
1478
|
+
}
|
|
1479
|
+
type AxGenerateResult<OUT extends AxGenOut> = OUT & {
|
|
1480
|
+
functions?: AxChatResponseFunctionCall[];
|
|
1481
|
+
};
|
|
1482
|
+
interface AxResponseHandlerArgs<T> {
|
|
1483
|
+
ai: Readonly<AxAIService>;
|
|
1484
|
+
model?: string;
|
|
1485
|
+
res: T;
|
|
1486
|
+
usageInfo: {
|
|
1487
|
+
ai: string;
|
|
1488
|
+
model: string;
|
|
1489
|
+
};
|
|
1490
|
+
mem: AxAIMemory;
|
|
1491
|
+
sessionId?: string;
|
|
1492
|
+
traceId?: string;
|
|
1493
|
+
functions?: Readonly<AxFunction[]>;
|
|
1494
|
+
}
|
|
1495
|
+
declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<AxGenOut> = AxGenerateResult<AxGenOut>> extends AxProgramWithSignature<IN, OUT> {
|
|
1496
|
+
private promptTemplate;
|
|
1497
|
+
private asserts;
|
|
1498
|
+
private streamingAsserts;
|
|
1499
|
+
private options?;
|
|
1500
|
+
private functions?;
|
|
1501
|
+
private functionsExecuted;
|
|
1502
|
+
constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxGenOptions>);
|
|
1503
|
+
addAssert: (fn: AxAssertion["fn"], message?: string, optional?: boolean) => void;
|
|
1504
|
+
addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string, optional?: boolean) => void;
|
|
1505
|
+
private forwardSendRequest;
|
|
1506
|
+
private forwardCore;
|
|
1507
|
+
private processSteamingResponse;
|
|
1508
|
+
private processResponse;
|
|
1509
|
+
private _forward;
|
|
1510
|
+
forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
interface AxAgentic extends AxTunable, AxUsable {
|
|
1514
|
+
getFunction(): AxFunction;
|
|
1515
|
+
}
|
|
1516
|
+
type AxAgentOptions = Omit<AxGenOptions, 'functions'>;
|
|
1517
|
+
declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAgentic {
|
|
1518
|
+
private ai?;
|
|
1519
|
+
private signature;
|
|
1520
|
+
private program;
|
|
1521
|
+
private agents?;
|
|
1522
|
+
private name;
|
|
1523
|
+
private description;
|
|
1524
|
+
private subAgentList?;
|
|
1525
|
+
private func;
|
|
1526
|
+
constructor({ ai, name, description, signature, agents, functions, }: Readonly<{
|
|
1527
|
+
ai?: Readonly<AxAIService>;
|
|
1528
|
+
name: string;
|
|
1529
|
+
description: string;
|
|
1530
|
+
signature: AxSignature | string;
|
|
1531
|
+
agents?: AxAgentic[];
|
|
1532
|
+
functions?: AxFunction[];
|
|
1533
|
+
}>, options?: Readonly<AxAgentOptions>);
|
|
1534
|
+
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
1535
|
+
setId(id: string): void;
|
|
1536
|
+
setParentId(parentId: string): void;
|
|
1537
|
+
getTraces(): AxProgramTrace[];
|
|
1538
|
+
setDemos(demos: readonly AxProgramDemos[]): void;
|
|
1539
|
+
getUsage(): (AxTokenUsage & {
|
|
1540
|
+
ai: string;
|
|
1541
|
+
model: string;
|
|
1542
|
+
})[];
|
|
1543
|
+
resetUsage(): void;
|
|
1544
|
+
getFunction(): AxFunction;
|
|
1545
|
+
forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
interface AxApacheTikaArgs {
|
|
1549
|
+
url?: string | URL;
|
|
1550
|
+
fetch?: typeof fetch;
|
|
1551
|
+
}
|
|
1552
|
+
interface AxApacheTikaConvertOptions {
|
|
1553
|
+
format?: 'text' | 'html';
|
|
1554
|
+
}
|
|
1555
|
+
declare class AxApacheTika {
|
|
1556
|
+
private tikaUrl;
|
|
1557
|
+
private fetch?;
|
|
1558
|
+
constructor(args?: Readonly<AxApacheTikaArgs>);
|
|
1559
|
+
private _convert;
|
|
1560
|
+
convert(files: Readonly<string[] | Blob[]>, options?: Readonly<{
|
|
1561
|
+
batchSize?: number;
|
|
1562
|
+
format?: 'html' | 'text';
|
|
1563
|
+
}>): Promise<string[]>;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Options for the balancer.
|
|
1568
|
+
*/
|
|
1569
|
+
type AxBalancerOptions = {
|
|
1570
|
+
comparator?: (a: AxAIService, b: AxAIService) => number;
|
|
1571
|
+
};
|
|
1572
|
+
/**
|
|
1573
|
+
* Balancer that rotates through services.
|
|
1574
|
+
*/
|
|
1575
|
+
declare class AxBalancer implements AxAIService {
|
|
1576
|
+
private services;
|
|
1577
|
+
private currentServiceIndex;
|
|
1578
|
+
private currentService;
|
|
1579
|
+
constructor(services: readonly AxAIService[], options?: AxBalancerOptions);
|
|
1580
|
+
getModelMap(): AxAIModelMap | undefined;
|
|
1581
|
+
private getNextService;
|
|
1582
|
+
private reset;
|
|
1583
|
+
getName(): string;
|
|
1584
|
+
getModelInfo(): Readonly<AxModelInfoWithProvider>;
|
|
1585
|
+
getEmbedModelInfo(): Readonly<AxModelInfoWithProvider> | undefined;
|
|
1586
|
+
getFeatures(model?: string): {
|
|
1587
|
+
functions: boolean;
|
|
1588
|
+
streaming: boolean;
|
|
1589
|
+
};
|
|
1590
|
+
getMetrics(): AxAIServiceMetrics;
|
|
1591
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1592
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions> | undefined): Promise<AxEmbedResponse>;
|
|
1593
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
type AxExample = Record<string, AxFieldValue>;
|
|
1597
|
+
type AxMetricFn = <T extends AxGenOut = AxGenOut>(arg0: Readonly<{
|
|
1598
|
+
prediction: T;
|
|
1599
|
+
example: AxExample;
|
|
1600
|
+
}>) => boolean;
|
|
1601
|
+
type AxMetricFnArgs = Parameters<AxMetricFn>[0];
|
|
1602
|
+
type AxOptimizerArgs<IN extends AxGenIn, OUT extends AxGenOut> = {
|
|
1603
|
+
ai: AxAIService;
|
|
1604
|
+
program: Readonly<AxProgram<IN, OUT>>;
|
|
1605
|
+
examples: Readonly<AxExample[]>;
|
|
1606
|
+
options?: {
|
|
1607
|
+
maxRounds?: number;
|
|
1608
|
+
maxExamples?: number;
|
|
1609
|
+
maxDemos?: number;
|
|
1610
|
+
};
|
|
1611
|
+
};
|
|
1612
|
+
declare class AxBootstrapFewShot<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> {
|
|
1613
|
+
private ai;
|
|
1614
|
+
private program;
|
|
1615
|
+
private examples;
|
|
1616
|
+
private maxRounds;
|
|
1617
|
+
private maxDemos;
|
|
1618
|
+
private maxExamples;
|
|
1619
|
+
private traces;
|
|
1620
|
+
constructor({ ai, program, examples, options, }: Readonly<AxOptimizerArgs<IN, OUT>>);
|
|
1621
|
+
private compileRound;
|
|
1622
|
+
compile(metricFn: AxMetricFn, options?: Readonly<AxOptimizerArgs<IN, OUT>['options']>): Promise<AxProgramDemos[]>;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
type AxDBUpsertRequest = {
|
|
1626
|
+
id: string;
|
|
1627
|
+
text?: string;
|
|
1628
|
+
values?: readonly number[];
|
|
1629
|
+
metadata?: Record<string, string>;
|
|
1630
|
+
table: string;
|
|
1631
|
+
namespace?: string;
|
|
1632
|
+
};
|
|
1633
|
+
type AxDBUpsertResponse = {
|
|
1634
|
+
ids: string[];
|
|
1635
|
+
};
|
|
1636
|
+
type AxDBQueryRequest = {
|
|
1637
|
+
id?: string;
|
|
1638
|
+
text?: string;
|
|
1639
|
+
values?: readonly number[];
|
|
1640
|
+
table: string;
|
|
1641
|
+
columns?: string[];
|
|
1642
|
+
limit?: number;
|
|
1643
|
+
namespace?: string;
|
|
1644
|
+
};
|
|
1645
|
+
type AxDBQueryResponse = {
|
|
1646
|
+
matches: {
|
|
1647
|
+
id: string;
|
|
1648
|
+
score: number;
|
|
1649
|
+
metadata?: Record<string, string>;
|
|
1650
|
+
table?: string;
|
|
1651
|
+
}[];
|
|
1652
|
+
};
|
|
1653
|
+
interface AxDBService extends AxDBQueryService {
|
|
1654
|
+
upsert(req: Readonly<AxDBUpsertRequest>, update?: boolean): Promise<AxDBUpsertResponse>;
|
|
1655
|
+
batchUpsert(batchReq: Readonly<AxDBUpsertRequest[]>, update?: boolean): Promise<AxDBUpsertResponse>;
|
|
1656
|
+
}
|
|
1657
|
+
interface AxDBQueryService {
|
|
1658
|
+
query(req: Readonly<AxDBQueryRequest>): Promise<AxDBQueryResponse>;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
interface AxDBBaseArgs {
|
|
1662
|
+
fetch?: typeof fetch;
|
|
1663
|
+
tracer?: Tracer;
|
|
1664
|
+
}
|
|
1665
|
+
interface AxDBBaseOpOptions {
|
|
1666
|
+
span?: Span;
|
|
1667
|
+
}
|
|
1668
|
+
declare class AxDBBase implements AxDBService {
|
|
1669
|
+
protected name: string;
|
|
1670
|
+
protected fetch?: typeof fetch;
|
|
1671
|
+
private tracer?;
|
|
1672
|
+
_upsert?: (req: Readonly<AxDBUpsertRequest>, update?: boolean, options?: Readonly<AxDBBaseOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1673
|
+
_batchUpsert?: (batchReq: Readonly<AxDBUpsertRequest[]>, update?: boolean, options?: Readonly<AxDBBaseOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1674
|
+
_query?: (req: Readonly<AxDBQueryRequest>, options?: Readonly<AxDBBaseOpOptions>) => Promise<AxDBQueryResponse>;
|
|
1675
|
+
constructor({ name, fetch, tracer, }: Readonly<AxDBBaseArgs & {
|
|
1676
|
+
name: string;
|
|
1677
|
+
}>);
|
|
1678
|
+
upsert(req: Readonly<AxDBUpsertRequest>, update?: boolean): Promise<AxDBUpsertResponse>;
|
|
1679
|
+
batchUpsert(req: Readonly<AxDBUpsertRequest[]>, update?: boolean): Promise<AxDBUpsertResponse>;
|
|
1680
|
+
query(req: Readonly<AxDBQueryRequest>): Promise<AxDBQueryResponse>;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
type AxDBCloudflareOpOptions = AxDBBaseOpOptions;
|
|
1684
|
+
interface AxDBCloudflareArgs extends AxDBBaseArgs {
|
|
1685
|
+
name: 'cloudflare';
|
|
1686
|
+
apiKey: string;
|
|
1687
|
+
accountId: string;
|
|
1688
|
+
fetch?: typeof fetch;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Cloudflare: DB Service
|
|
1692
|
+
*/
|
|
1693
|
+
declare class AxDBCloudflare extends AxDBBase {
|
|
1694
|
+
private apiKey;
|
|
1695
|
+
private accountId;
|
|
1696
|
+
constructor({ apiKey, accountId, fetch, tracer, }: Readonly<Omit<AxDBCloudflareArgs, 'name'>>);
|
|
1697
|
+
_upsert: (req: Readonly<AxDBUpsertRequest>, _update?: boolean, options?: Readonly<AxDBCloudflareOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1698
|
+
batchUpsert: (batchReq: Readonly<AxDBUpsertRequest[]>, update?: boolean, options?: Readonly<AxDBCloudflareOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1699
|
+
query: (req: Readonly<AxDBQueryRequest>, options?: Readonly<AxDBCloudflareOpOptions>) => Promise<AxDBQueryResponse>;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
type AxDBMemoryOpOptions = AxDBBaseOpOptions;
|
|
1703
|
+
interface AxDBMemoryArgs extends AxDBBaseArgs {
|
|
1704
|
+
name: 'memory';
|
|
1705
|
+
}
|
|
1706
|
+
type AxDBState = Record<string, Record<string, AxDBUpsertRequest>>;
|
|
1707
|
+
/**
|
|
1708
|
+
* MemoryDB: DB Service
|
|
1709
|
+
*/
|
|
1710
|
+
declare class AxDBMemory extends AxDBBase {
|
|
1711
|
+
private state;
|
|
1712
|
+
constructor({ tracer }?: Readonly<Omit<AxDBMemoryArgs, 'name'>>);
|
|
1713
|
+
_upsert: (req: Readonly<AxDBUpsertRequest>, _update?: boolean, _options?: Readonly<AxDBMemoryOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1714
|
+
_batchUpsert: (batchReq: Readonly<AxDBUpsertRequest[]>, update?: boolean, _options?: Readonly<AxDBMemoryOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1715
|
+
_query: (req: Readonly<AxDBQueryRequest>, _options?: Readonly<AxDBMemoryOpOptions>) => Promise<AxDBQueryResponse>;
|
|
1716
|
+
getDB: () => AxDBState;
|
|
1717
|
+
setDB: (state: AxDBState) => void;
|
|
1718
|
+
clearDB: () => void;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
type AxDBPineconeOpOptions = AxDBBaseOpOptions;
|
|
1722
|
+
interface AxDBPineconeArgs extends AxDBBaseArgs {
|
|
1723
|
+
name: 'pinecone';
|
|
1724
|
+
apiKey: string;
|
|
1725
|
+
host: string;
|
|
1726
|
+
fetch?: typeof fetch;
|
|
1727
|
+
}
|
|
1728
|
+
/**
|
|
1729
|
+
* Pinecone: DB Service
|
|
1730
|
+
*/
|
|
1731
|
+
declare class AxDBPinecone extends AxDBBase {
|
|
1732
|
+
private apiKey;
|
|
1733
|
+
private apiURL;
|
|
1734
|
+
constructor({ apiKey, host, fetch, tracer, }: Readonly<Omit<AxDBPineconeArgs, 'name'>>);
|
|
1735
|
+
_upsert: (req: Readonly<AxDBUpsertRequest>, update?: boolean, options?: Readonly<AxDBPineconeOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1736
|
+
_batchUpsert: (batchReq: Readonly<AxDBUpsertRequest[]>, _update?: boolean, options?: Readonly<AxDBPineconeOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1737
|
+
query: (req: Readonly<AxDBQueryRequest>, options?: Readonly<AxDBPineconeOpOptions>) => Promise<AxDBQueryResponse>;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
type AxDBWeaviateOpOptions = AxDBBaseOpOptions;
|
|
1741
|
+
interface AxDBWeaviateArgs extends AxDBBaseArgs {
|
|
1742
|
+
name: 'weaviate';
|
|
1743
|
+
apiKey: string;
|
|
1744
|
+
host: string;
|
|
1745
|
+
fetch?: typeof fetch;
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Weaviate: DB Service
|
|
1749
|
+
*/
|
|
1750
|
+
declare class AxDBWeaviate extends AxDBBase {
|
|
1751
|
+
private apiKey;
|
|
1752
|
+
private apiURL;
|
|
1753
|
+
constructor({ apiKey, host, fetch, tracer, }: Readonly<Omit<AxDBWeaviateArgs, 'name'>>);
|
|
1754
|
+
_upsert: (req: Readonly<AxDBUpsertRequest>, update?: boolean, options?: Readonly<AxDBWeaviateOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1755
|
+
_batchUpsert: (batchReq: Readonly<AxDBUpsertRequest[]>, update?: boolean, options?: Readonly<AxDBWeaviateOpOptions>) => Promise<AxDBUpsertResponse>;
|
|
1756
|
+
_query: (req: Readonly<AxDBQueryRequest>, options?: Readonly<AxDBWeaviateOpOptions>) => Promise<AxDBQueryResponse>;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
type AxDBArgs = AxDBCloudflareArgs | AxDBPineconeArgs | AxDBWeaviateArgs | AxDBMemoryArgs;
|
|
1760
|
+
declare class AxDB implements AxDBService {
|
|
1761
|
+
private db;
|
|
1762
|
+
constructor(args: Readonly<AxDBArgs>);
|
|
1763
|
+
upsert(req: Readonly<AxDBUpsertRequest>, update?: boolean): Promise<AxDBUpsertResponse>;
|
|
1764
|
+
batchUpsert(batchReq: Readonly<AxDBUpsertRequest[]>, update?: boolean): Promise<AxDBUpsertResponse>;
|
|
1765
|
+
query(req: Readonly<AxDBQueryRequest>): Promise<AxDBQueryResponse>;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
type AxRewriteIn = {
|
|
1769
|
+
query: string;
|
|
1770
|
+
};
|
|
1771
|
+
type AxRewriteOut = {
|
|
1772
|
+
rewrittenQuery: string;
|
|
1773
|
+
};
|
|
1774
|
+
type AxRerankerIn = {
|
|
1775
|
+
query: string;
|
|
1776
|
+
items: string[];
|
|
1777
|
+
};
|
|
1778
|
+
type AxRerankerOut = {
|
|
1779
|
+
rankedItems: string[];
|
|
1780
|
+
};
|
|
1781
|
+
interface AxDBLoaderOptions {
|
|
1782
|
+
chunker?: (text: string) => string[];
|
|
1783
|
+
rewriter?: AxProgram<AxRewriteIn, AxRewriteOut>;
|
|
1784
|
+
reranker?: AxProgram<AxRerankerIn, AxRerankerOut>;
|
|
1785
|
+
}
|
|
1786
|
+
interface AxDBManagerArgs {
|
|
1787
|
+
ai: AxAIService;
|
|
1788
|
+
db: AxDBService;
|
|
1789
|
+
config?: AxDBLoaderOptions;
|
|
1790
|
+
}
|
|
1791
|
+
interface AxDBMatch {
|
|
1792
|
+
score: number;
|
|
1793
|
+
text: string;
|
|
1794
|
+
}
|
|
1795
|
+
declare class AxDBManager {
|
|
1796
|
+
private ai;
|
|
1797
|
+
private db;
|
|
1798
|
+
private chunker;
|
|
1799
|
+
private rewriter?;
|
|
1800
|
+
private reranker?;
|
|
1801
|
+
constructor({ ai, db, config }: Readonly<AxDBManagerArgs>);
|
|
1802
|
+
private defaultChunker;
|
|
1803
|
+
insert: (text: Readonly<string | string[]>, options?: Readonly<{
|
|
1804
|
+
batchSize?: number;
|
|
1805
|
+
maxWordsPerChunk?: number;
|
|
1806
|
+
minWordsPerChunk?: number;
|
|
1807
|
+
}>) => Promise<void>;
|
|
1808
|
+
query: (query: Readonly<string | string[] | number | number[]>, { topPercent }?: Readonly<{
|
|
1809
|
+
topPercent?: number;
|
|
1810
|
+
}> | undefined) => Promise<AxDBMatch[][]>;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
interface AxDockerContainer {
|
|
1814
|
+
Id: string;
|
|
1815
|
+
Names: string[];
|
|
1816
|
+
Image: string;
|
|
1817
|
+
ImageID: string;
|
|
1818
|
+
Command: string;
|
|
1819
|
+
Created: number;
|
|
1820
|
+
State: {
|
|
1821
|
+
Status: string;
|
|
1822
|
+
Running: boolean;
|
|
1823
|
+
Paused: boolean;
|
|
1824
|
+
Restarting: boolean;
|
|
1825
|
+
OOMKilled: boolean;
|
|
1826
|
+
Dead: boolean;
|
|
1827
|
+
Pid: number;
|
|
1828
|
+
ExitCode: number;
|
|
1829
|
+
Error: string;
|
|
1830
|
+
StartedAt: Date;
|
|
1831
|
+
FinishedAt: Date;
|
|
1832
|
+
};
|
|
1833
|
+
Status: string;
|
|
1834
|
+
Ports: Array<{
|
|
1835
|
+
IP: string;
|
|
1836
|
+
PrivatePort: number;
|
|
1837
|
+
PublicPort: number;
|
|
1838
|
+
Type: string;
|
|
1839
|
+
}>;
|
|
1840
|
+
Labels: {
|
|
1841
|
+
[key: string]: string;
|
|
1842
|
+
};
|
|
1843
|
+
SizeRw: number;
|
|
1844
|
+
SizeRootFs: number;
|
|
1845
|
+
HostConfig: {
|
|
1846
|
+
NetworkMode: string;
|
|
1847
|
+
};
|
|
1848
|
+
NetworkSettings: {
|
|
1849
|
+
Networks: {
|
|
1850
|
+
[key: string]: {
|
|
1851
|
+
IPAddress: string;
|
|
1852
|
+
IPPrefixLen: number;
|
|
1853
|
+
Gateway: string;
|
|
1854
|
+
MacAddress: string;
|
|
1855
|
+
};
|
|
1856
|
+
};
|
|
1857
|
+
};
|
|
1858
|
+
Mounts: Array<{
|
|
1859
|
+
Type: string;
|
|
1860
|
+
Source: string;
|
|
1861
|
+
Destination: string;
|
|
1862
|
+
Mode: string;
|
|
1863
|
+
RW: boolean;
|
|
1864
|
+
Propagation: string;
|
|
1865
|
+
}>;
|
|
1866
|
+
}
|
|
1867
|
+
declare class AxDockerSession {
|
|
1868
|
+
private readonly apiUrl;
|
|
1869
|
+
private containerId;
|
|
1870
|
+
constructor(apiUrl?: string);
|
|
1871
|
+
pullImage(imageName: string): Promise<void>;
|
|
1872
|
+
createContainer({ imageName, volumes, doNotPullImage, tag, }: Readonly<{
|
|
1873
|
+
imageName: string;
|
|
1874
|
+
volumes?: Array<{
|
|
1875
|
+
hostPath: string;
|
|
1876
|
+
containerPath: string;
|
|
1877
|
+
}>;
|
|
1878
|
+
doNotPullImage?: boolean;
|
|
1879
|
+
tag?: string;
|
|
1880
|
+
}>): Promise<{
|
|
1881
|
+
Id: string;
|
|
1882
|
+
}>;
|
|
1883
|
+
findOrCreateContainer({ imageName, volumes, doNotPullImage, tag, }: Readonly<{
|
|
1884
|
+
imageName: string;
|
|
1885
|
+
volumes?: Array<{
|
|
1886
|
+
hostPath: string;
|
|
1887
|
+
containerPath: string;
|
|
1888
|
+
}>;
|
|
1889
|
+
doNotPullImage?: boolean;
|
|
1890
|
+
tag: string;
|
|
1891
|
+
}>): Promise<{
|
|
1892
|
+
Id: string;
|
|
1893
|
+
isNew: boolean;
|
|
1894
|
+
}>;
|
|
1895
|
+
startContainer(): Promise<void>;
|
|
1896
|
+
connectToContainer(containerId: string): Promise<void>;
|
|
1897
|
+
stopContainers({ tag, remove, timeout, }: Readonly<{
|
|
1898
|
+
tag?: string;
|
|
1899
|
+
remove?: boolean;
|
|
1900
|
+
timeout?: number;
|
|
1901
|
+
}>): Promise<Array<{
|
|
1902
|
+
Id: string;
|
|
1903
|
+
Action: 'stopped' | 'removed';
|
|
1904
|
+
}>>;
|
|
1905
|
+
listContainers(all?: boolean): Promise<AxDockerContainer[]>;
|
|
1906
|
+
getContainerLogs(): Promise<string>;
|
|
1907
|
+
executeCommand(command: string): Promise<string>;
|
|
1908
|
+
private getContainerInfo;
|
|
1909
|
+
private waitForContainerToBeRunning;
|
|
1910
|
+
private fetchDockerAPI;
|
|
1911
|
+
toFunction(): AxFunction;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
type AxDataRow = {
|
|
1915
|
+
row: Record<string, AxFieldValue>;
|
|
1916
|
+
};
|
|
1917
|
+
declare class AxHFDataLoader {
|
|
1918
|
+
private rows;
|
|
1919
|
+
private baseUrl;
|
|
1920
|
+
private dataset;
|
|
1921
|
+
private split;
|
|
1922
|
+
private config;
|
|
1923
|
+
private options?;
|
|
1924
|
+
constructor({ dataset, split, config, options, }: Readonly<{
|
|
1925
|
+
dataset: string;
|
|
1926
|
+
split: string;
|
|
1927
|
+
config: string;
|
|
1928
|
+
options?: Readonly<{
|
|
1929
|
+
offset?: number;
|
|
1930
|
+
length?: number;
|
|
1931
|
+
}>;
|
|
1932
|
+
}>);
|
|
1933
|
+
private fetchDataFromAPI;
|
|
1934
|
+
loadData(): Promise<AxDataRow[]>;
|
|
1935
|
+
setData(rows: AxDataRow[]): void;
|
|
1936
|
+
getData(): AxDataRow[];
|
|
1937
|
+
getRows<T>({ count, fields, renameMap, }: Readonly<{
|
|
1938
|
+
count: number;
|
|
1939
|
+
fields: readonly string[];
|
|
1940
|
+
renameMap?: Record<string, string>;
|
|
1941
|
+
}>): Promise<T[]>;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
declare enum AxJSInterpreterPermission {
|
|
1945
|
+
FS = "node:fs",
|
|
1946
|
+
NET = "net",
|
|
1947
|
+
OS = "os",
|
|
1948
|
+
CRYPTO = "crypto",
|
|
1949
|
+
PROCESS = "process"
|
|
1950
|
+
}
|
|
1951
|
+
declare class AxJSInterpreter {
|
|
1952
|
+
private permissions;
|
|
1953
|
+
constructor({ permissions, }?: Readonly<{
|
|
1954
|
+
permissions?: readonly AxJSInterpreterPermission[];
|
|
1955
|
+
}> | undefined);
|
|
1956
|
+
private codeInterpreterJavascript;
|
|
1957
|
+
toFunction(): AxFunction;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
declare enum AxLLMRequestTypeValues {
|
|
1961
|
+
COMPLETION = "completion",
|
|
1962
|
+
CHAT = "chat",
|
|
1963
|
+
RERANK = "rerank",
|
|
1964
|
+
UNKNOWN = "unknown"
|
|
1965
|
+
}
|
|
1966
|
+
declare enum AxSpanKindValues {
|
|
1967
|
+
WORKFLOW = "workflow",
|
|
1968
|
+
TASK = "task",
|
|
1969
|
+
AGENT = "agent",
|
|
1970
|
+
TOOL = "tool",
|
|
1971
|
+
UNKNOWN = "unknown"
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
interface AxRateLimiterTokenUsageOptions {
|
|
1975
|
+
debug?: boolean;
|
|
1976
|
+
}
|
|
1977
|
+
declare class AxRateLimiterTokenUsage {
|
|
1978
|
+
private options?;
|
|
1979
|
+
private maxTokens;
|
|
1980
|
+
private refillRate;
|
|
1981
|
+
private currentTokens;
|
|
1982
|
+
private lastRefillTime;
|
|
1983
|
+
constructor(maxTokens: number, refillRate: number, options?: Readonly<AxRateLimiterTokenUsageOptions>);
|
|
1984
|
+
private refillTokens;
|
|
1985
|
+
private waitUntilTokensAvailable;
|
|
1986
|
+
acquire(tokens: number): Promise<void>;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
interface AxRouterForwardOptions {
|
|
1990
|
+
cutoff?: number;
|
|
1991
|
+
}
|
|
1992
|
+
declare class AxRoute {
|
|
1993
|
+
private readonly name;
|
|
1994
|
+
private readonly context;
|
|
1995
|
+
constructor(name: string, context: readonly string[]);
|
|
1996
|
+
getName(): string;
|
|
1997
|
+
getContext(): readonly string[];
|
|
1998
|
+
}
|
|
1999
|
+
declare class AxRouter {
|
|
2000
|
+
private readonly ai;
|
|
2001
|
+
private db;
|
|
2002
|
+
private debug?;
|
|
2003
|
+
constructor(ai: AxAIService);
|
|
2004
|
+
getState(): AxDBState | undefined;
|
|
2005
|
+
setState(state: AxDBState): void;
|
|
2006
|
+
setRoutes: (routes: readonly AxRoute[]) => Promise<void>;
|
|
2007
|
+
forward(text: string, options?: Readonly<AxRouterForwardOptions>): Promise<string>;
|
|
2008
|
+
setOptions(options: Readonly<{
|
|
2009
|
+
debug?: boolean;
|
|
2010
|
+
}>): void;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
type AxEvaluateArgs<IN extends AxGenIn, OUT extends AxGenOut> = {
|
|
2014
|
+
ai: AxAIService;
|
|
2015
|
+
program: Readonly<AxProgram<IN, OUT>>;
|
|
2016
|
+
examples: Readonly<AxExample[]>;
|
|
2017
|
+
};
|
|
2018
|
+
declare class AxTestPrompt<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> {
|
|
2019
|
+
private ai;
|
|
2020
|
+
private program;
|
|
2021
|
+
private examples;
|
|
2022
|
+
constructor({ ai, program, examples, }: Readonly<AxEvaluateArgs<IN, OUT>>);
|
|
2023
|
+
run(metricFn: AxMetricFn): Promise<void>;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
declare class AxChainOfThought<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> extends AxGen<IN, OUT & {
|
|
2027
|
+
reason: string;
|
|
2028
|
+
}> {
|
|
2029
|
+
constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxGenOptions>);
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
declare class AxDefaultQueryRewriter extends AxGen<AxRewriteIn, AxRewriteOut> {
|
|
2033
|
+
constructor(options?: Readonly<AxGenOptions>);
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
declare class AxDefaultResultReranker extends AxGen<AxRerankerIn, AxRerankerOut> {
|
|
2037
|
+
constructor(options?: Readonly<AxGenOptions>);
|
|
2038
|
+
forward: (ai: Readonly<AxAIService>, input: Readonly<AxRerankerIn>, options?: Readonly<AxProgramForwardOptions>) => Promise<AxRerankerOut>;
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
declare class AxEmbeddingAdapter {
|
|
2042
|
+
private aiService;
|
|
2043
|
+
private info;
|
|
2044
|
+
private func;
|
|
2045
|
+
constructor({ ai, info, func, }: Readonly<{
|
|
2046
|
+
ai: AxAIService;
|
|
2047
|
+
info: Readonly<{
|
|
2048
|
+
name: string;
|
|
2049
|
+
description: string;
|
|
2050
|
+
argumentDescription: string;
|
|
2051
|
+
}>;
|
|
2052
|
+
func: (args: readonly number[], extra?: Readonly<AxAIServiceActionOptions>) => Promise<unknown>;
|
|
2053
|
+
}>);
|
|
2054
|
+
private embedAdapter;
|
|
2055
|
+
toFunction(): AxFunction;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
declare class AxInstanceRegistry<T> {
|
|
2059
|
+
private reg;
|
|
2060
|
+
constructor();
|
|
2061
|
+
register(instance: T): void;
|
|
2062
|
+
[Symbol.iterator](): Generator<T, void, unknown>;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
declare class AxRAG extends AxChainOfThought<{
|
|
2066
|
+
context: string[];
|
|
2067
|
+
question: string;
|
|
2068
|
+
}, {
|
|
2069
|
+
answer: string;
|
|
2070
|
+
}> {
|
|
2071
|
+
private genQuery;
|
|
2072
|
+
private queryFn;
|
|
2073
|
+
private maxHops;
|
|
2074
|
+
constructor(queryFn: (query: string) => Promise<string>, options: Readonly<AxGenOptions & {
|
|
2075
|
+
maxHops?: number;
|
|
2076
|
+
}>);
|
|
2077
|
+
forward(ai: Readonly<AxAIService>, { question }: Readonly<{
|
|
2078
|
+
question: string;
|
|
2079
|
+
}>, options?: Readonly<AxProgramForwardOptions>): Promise<{
|
|
2080
|
+
answer: string;
|
|
2081
|
+
reason: string;
|
|
2082
|
+
}>;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
declare class AxValidationError extends Error {
|
|
2086
|
+
private field;
|
|
2087
|
+
private value;
|
|
2088
|
+
constructor({ message, field, value, }: Readonly<{
|
|
2089
|
+
message: string;
|
|
2090
|
+
field: AxField;
|
|
2091
|
+
value: string;
|
|
2092
|
+
}>);
|
|
2093
|
+
getField: () => AxField;
|
|
2094
|
+
getValue: () => string;
|
|
2095
|
+
getFixingInstructions: () => {
|
|
2096
|
+
name: string;
|
|
2097
|
+
title: string;
|
|
2098
|
+
description: string;
|
|
2099
|
+
}[];
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelMap, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, type AxAIServiceImpl, type AxAIServiceMetrics, type AxAIServiceOptions, AxAITogether, type AxAITogetherArgs, type AxAPI, AxAgent, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, type AxBaseAIFeatures, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldTemplateFn, type AxFieldValue, type AxFunction, type AxFunctionExec, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMemory, type AxMetricFn, type AxMetricFnArgs, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxRoute, AxRouter, type AxRouterForwardOptions, AxSignature, AxSpanKindValues, type AxStreamingAssertion, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, AxValidationError };
|