@ax-llm/ax 10.0.39 → 10.0.41
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 +718 -339
- package/index.cjs.map +1 -1
- package/index.d.cts +89 -17
- package/index.d.ts +89 -17
- package/index.js +716 -339
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReadableStream } from 'stream/web';
|
|
1
|
+
import { ReadableStream as ReadableStream$1 } from 'stream/web';
|
|
2
2
|
import { Tracer, Span } from '@opentelemetry/api';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -176,10 +176,10 @@ type AxEmbedRequest = {
|
|
|
176
176
|
embedModel?: string;
|
|
177
177
|
};
|
|
178
178
|
type AxInternalEmbedRequest = Omit<AxEmbedRequest, 'embedModel'> & Required<Pick<AxEmbedRequest, 'embedModel'>>;
|
|
179
|
-
type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream<T>>, info: Readonly<{
|
|
179
|
+
type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream$1<T>>, info: Readonly<{
|
|
180
180
|
modelUsage?: AxTokenUsage;
|
|
181
181
|
embedModelUsage?: AxTokenUsage;
|
|
182
|
-
}>) => Promise<T | ReadableStream<T>>;
|
|
182
|
+
}>) => Promise<T | ReadableStream$1<T>>;
|
|
183
183
|
type AxAIPromptConfig = {
|
|
184
184
|
stream?: boolean;
|
|
185
185
|
};
|
|
@@ -205,7 +205,7 @@ interface AxAIService {
|
|
|
205
205
|
};
|
|
206
206
|
getModelMap(): AxAIModelMap | undefined;
|
|
207
207
|
getMetrics(): AxAIServiceMetrics;
|
|
208
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
208
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
209
209
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
210
210
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
211
211
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -267,7 +267,7 @@ declare class AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponse
|
|
|
267
267
|
private updateLatencyMetrics;
|
|
268
268
|
private updateErrorMetrics;
|
|
269
269
|
getMetrics(): AxAIServiceMetrics;
|
|
270
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
270
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
271
271
|
private _chat1;
|
|
272
272
|
private _chat2;
|
|
273
273
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
@@ -285,8 +285,15 @@ declare enum AxAIAnthropicModel {
|
|
|
285
285
|
Claude21 = "claude-2.1",
|
|
286
286
|
ClaudeInstant12 = "claude-instant-1.2"
|
|
287
287
|
}
|
|
288
|
+
declare enum AxAIAnthropicVertexModel {
|
|
289
|
+
Claude35Haiku = "claude-3-5-haiku",
|
|
290
|
+
Claude35Sonnet = "claude-3-5-sonnet",
|
|
291
|
+
Claude35SonnetV2 = "claude-3-5-sonnet-v2",
|
|
292
|
+
Claude3Haiku = "claude-3-haiku",
|
|
293
|
+
Claude3Opus = "claude-3-opus"
|
|
294
|
+
}
|
|
288
295
|
type AxAIAnthropicConfig = AxModelConfig & {
|
|
289
|
-
model: AxAIAnthropicModel;
|
|
296
|
+
model: AxAIAnthropicModel | AxAIAnthropicVertexModel;
|
|
290
297
|
};
|
|
291
298
|
type AxAIAnthropicChatRequestCacheParam = {
|
|
292
299
|
cache_control?: {
|
|
@@ -294,7 +301,8 @@ type AxAIAnthropicChatRequestCacheParam = {
|
|
|
294
301
|
};
|
|
295
302
|
};
|
|
296
303
|
type AxAIAnthropicChatRequest = {
|
|
297
|
-
model
|
|
304
|
+
model?: string;
|
|
305
|
+
anthropic_version?: string;
|
|
298
306
|
messages: ({
|
|
299
307
|
role: 'user';
|
|
300
308
|
content: string | (({
|
|
@@ -459,13 +467,15 @@ type AxAIAnthropicChatResponseDelta = AxAIAnthropicMessageStartEvent | AxAIAnthr
|
|
|
459
467
|
|
|
460
468
|
interface AxAIAnthropicArgs {
|
|
461
469
|
name: 'anthropic';
|
|
462
|
-
apiKey
|
|
470
|
+
apiKey?: string;
|
|
471
|
+
projectId?: string;
|
|
472
|
+
region?: string;
|
|
463
473
|
config?: Readonly<Partial<AxAIAnthropicConfig>>;
|
|
464
474
|
options?: Readonly<AxAIServiceOptions>;
|
|
465
475
|
modelMap?: Record<string, AxAIAnthropicModel | string>;
|
|
466
476
|
}
|
|
467
477
|
declare class AxAIAnthropic extends AxBaseAI<AxAIAnthropicChatRequest, unknown, AxAIAnthropicChatResponse, AxAIAnthropicChatResponseDelta, unknown> {
|
|
468
|
-
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAIAnthropicArgs, 'name'>>);
|
|
478
|
+
constructor({ apiKey, projectId, region, config, options, modelMap, }: Readonly<Omit<AxAIAnthropicArgs, 'name'>>);
|
|
469
479
|
}
|
|
470
480
|
|
|
471
481
|
declare enum AxAIOpenAIModel {
|
|
@@ -991,7 +1001,6 @@ interface AxAIGoogleGeminiArgs {
|
|
|
991
1001
|
apiKey?: string;
|
|
992
1002
|
projectId?: string;
|
|
993
1003
|
region?: string;
|
|
994
|
-
keyFile?: string;
|
|
995
1004
|
config?: Readonly<Partial<AxAIGoogleGeminiConfig>>;
|
|
996
1005
|
options?: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>;
|
|
997
1006
|
modelMap?: Record<string, AxAIGoogleGeminiModel | AxAIGoogleGeminiEmbedModel | string>;
|
|
@@ -1000,7 +1009,7 @@ interface AxAIGoogleGeminiArgs {
|
|
|
1000
1009
|
* AxAIGoogleGemini: AI Service
|
|
1001
1010
|
*/
|
|
1002
1011
|
declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest | AxAIGoogleVertexBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse | AxAIGoogleVertexBatchEmbedResponse> {
|
|
1003
|
-
constructor({ apiKey, projectId, region,
|
|
1012
|
+
constructor({ apiKey, projectId, region, config, options, modelMap, }: Readonly<Omit<AxAIGoogleGeminiArgs, 'name'>>);
|
|
1004
1013
|
}
|
|
1005
1014
|
|
|
1006
1015
|
declare enum AxAIGroqModel {
|
|
@@ -1224,7 +1233,7 @@ declare class AxAI implements AxAIService {
|
|
|
1224
1233
|
};
|
|
1225
1234
|
getModelMap(): AxAIModelMap | undefined;
|
|
1226
1235
|
getMetrics(): AxAIServiceMetrics;
|
|
1227
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1236
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
1228
1237
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
1229
1238
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1230
1239
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -1322,6 +1331,12 @@ type AxProgramForwardOptions = {
|
|
|
1322
1331
|
functionCall?: AxChatRequest['functionCall'];
|
|
1323
1332
|
stopFunction?: string;
|
|
1324
1333
|
};
|
|
1334
|
+
type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
|
|
1335
|
+
type AxGenDeltaOut<OUT> = {
|
|
1336
|
+
version: number;
|
|
1337
|
+
delta: Partial<OUT>;
|
|
1338
|
+
};
|
|
1339
|
+
type AxGenStreamingOut<OUT> = AsyncGenerator<AxGenDeltaOut<OUT>, void | OUT, unknown>;
|
|
1325
1340
|
interface AxTunable {
|
|
1326
1341
|
setExamples: (examples: Readonly<AxProgramExamples>) => void;
|
|
1327
1342
|
setId: (id: string) => void;
|
|
@@ -1353,6 +1368,7 @@ declare class AxProgramWithSignature<IN extends AxGenIn, OUT extends AxGenOut> i
|
|
|
1353
1368
|
getSignature(): AxSignature;
|
|
1354
1369
|
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
1355
1370
|
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1371
|
+
streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
|
|
1356
1372
|
setId(id: string): void;
|
|
1357
1373
|
setParentId(parentId: string): void;
|
|
1358
1374
|
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
@@ -1370,6 +1386,7 @@ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxT
|
|
|
1370
1386
|
constructor();
|
|
1371
1387
|
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
1372
1388
|
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1389
|
+
streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
|
|
1373
1390
|
setId(id: string): void;
|
|
1374
1391
|
setParentId(parentId: string): void;
|
|
1375
1392
|
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
@@ -1460,7 +1477,7 @@ declare class AxPromptTemplate {
|
|
|
1460
1477
|
examples?: Record<string, AxFieldValue>[];
|
|
1461
1478
|
demos?: Record<string, AxFieldValue>[];
|
|
1462
1479
|
}>) => AxChatRequest["chatPrompt"];
|
|
1463
|
-
renderExtraFields: (extraFields: readonly AxIField[]) =>
|
|
1480
|
+
renderExtraFields: (extraFields: readonly AxIField[]) => ({
|
|
1464
1481
|
type: "text";
|
|
1465
1482
|
text: string;
|
|
1466
1483
|
cache?: boolean;
|
|
@@ -1517,6 +1534,15 @@ interface AxResponseHandlerArgs<T> {
|
|
|
1517
1534
|
traceId?: string;
|
|
1518
1535
|
functions?: Readonly<AxFunction[]>;
|
|
1519
1536
|
}
|
|
1537
|
+
interface AxStreamingEvent<T> {
|
|
1538
|
+
event: 'delta' | 'done' | 'error';
|
|
1539
|
+
data: {
|
|
1540
|
+
contentDelta?: string;
|
|
1541
|
+
partialValues?: Partial<T>;
|
|
1542
|
+
error?: string;
|
|
1543
|
+
functions?: AxChatResponseFunctionCall[];
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1520
1546
|
declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<AxGenOut> = AxGenerateResult<AxGenOut>> extends AxProgramWithSignature<IN, OUT> {
|
|
1521
1547
|
private promptTemplate;
|
|
1522
1548
|
private asserts;
|
|
@@ -1529,10 +1555,19 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
|
|
|
1529
1555
|
addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string, optional?: boolean) => void;
|
|
1530
1556
|
private forwardSendRequest;
|
|
1531
1557
|
private forwardCore;
|
|
1532
|
-
private
|
|
1558
|
+
private processStreamingResponse;
|
|
1533
1559
|
private processResponse;
|
|
1534
|
-
private
|
|
1560
|
+
private _forward2;
|
|
1561
|
+
private shouldContinueSteps;
|
|
1562
|
+
_forward1(ai: Readonly<AxAIService>, values: IN, options: Readonly<AxProgramForwardOptions>): AsyncGenerator<{
|
|
1563
|
+
version: number;
|
|
1564
|
+
delta: Partial<OUT>;
|
|
1565
|
+
}, void, unknown>;
|
|
1535
1566
|
forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1567
|
+
streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AsyncGenerator<{
|
|
1568
|
+
version: number;
|
|
1569
|
+
delta: Partial<OUT>;
|
|
1570
|
+
}, void, unknown>;
|
|
1536
1571
|
}
|
|
1537
1572
|
|
|
1538
1573
|
interface AxAgentic extends AxTunable, AxUsable {
|
|
@@ -1567,7 +1602,9 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
|
|
|
1567
1602
|
})[];
|
|
1568
1603
|
resetUsage(): void;
|
|
1569
1604
|
getFunction(): AxFunction;
|
|
1605
|
+
private init;
|
|
1570
1606
|
forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1607
|
+
streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
|
|
1571
1608
|
}
|
|
1572
1609
|
|
|
1573
1610
|
interface AxApacheTikaArgs {
|
|
@@ -1621,7 +1658,7 @@ declare class AxBalancer implements AxAIService {
|
|
|
1621
1658
|
streaming: boolean;
|
|
1622
1659
|
};
|
|
1623
1660
|
getMetrics(): AxAIServiceMetrics;
|
|
1624
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1661
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
1625
1662
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions> | undefined): Promise<AxEmbedResponse>;
|
|
1626
1663
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1627
1664
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -2096,6 +2133,41 @@ declare class AxInstanceRegistry<T> {
|
|
|
2096
2133
|
[Symbol.iterator](): Generator<T, void, unknown>;
|
|
2097
2134
|
}
|
|
2098
2135
|
|
|
2136
|
+
declare class AxMockAIService implements AxAIService {
|
|
2137
|
+
private readonly config;
|
|
2138
|
+
private options;
|
|
2139
|
+
private metrics;
|
|
2140
|
+
constructor(config?: {
|
|
2141
|
+
name?: string;
|
|
2142
|
+
modelInfo?: Partial<AxModelInfoWithProvider>;
|
|
2143
|
+
embedModelInfo?: AxModelInfoWithProvider;
|
|
2144
|
+
features?: {
|
|
2145
|
+
functions?: boolean;
|
|
2146
|
+
streaming?: boolean;
|
|
2147
|
+
};
|
|
2148
|
+
modelMap?: AxAIModelMap;
|
|
2149
|
+
chatResponse?: AxChatResponse | ((req: Readonly<AxChatRequest>) => AxChatResponse | Promise<AxChatResponse>);
|
|
2150
|
+
embedResponse?: AxEmbedResponse | ((req: Readonly<AxEmbedRequest>) => AxEmbedResponse | Promise<AxEmbedResponse>);
|
|
2151
|
+
shouldError?: boolean;
|
|
2152
|
+
errorMessage?: string;
|
|
2153
|
+
latencyMs?: number;
|
|
2154
|
+
});
|
|
2155
|
+
getName(): string;
|
|
2156
|
+
getModelInfo(): Readonly<AxModelInfoWithProvider>;
|
|
2157
|
+
getEmbedModelInfo(): Readonly<AxModelInfoWithProvider> | undefined;
|
|
2158
|
+
getFeatures(_model?: string): {
|
|
2159
|
+
functions: boolean;
|
|
2160
|
+
streaming: boolean;
|
|
2161
|
+
};
|
|
2162
|
+
getModelMap(): AxAIModelMap | undefined;
|
|
2163
|
+
getMetrics(): AxAIServiceMetrics;
|
|
2164
|
+
chat(req: Readonly<AxChatRequest>, _options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
2165
|
+
embed(req: Readonly<AxEmbedRequest>, _options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
2166
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
2167
|
+
getOptions(): Readonly<AxAIServiceOptions>;
|
|
2168
|
+
private updateMetrics;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2099
2171
|
declare class AxRAG extends AxChainOfThought<{
|
|
2100
2172
|
context: string[];
|
|
2101
2173
|
question: string;
|
|
@@ -2116,4 +2188,4 @@ declare class AxRAG extends AxChainOfThought<{
|
|
|
2116
2188
|
}>;
|
|
2117
2189
|
}
|
|
2118
2190
|
|
|
2119
|
-
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, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, 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 };
|
|
2191
|
+
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, AxAIAnthropicVertexModel, 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, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, 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 AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMockAIService, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, 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, type AxStreamingEvent, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReadableStream } from 'stream/web';
|
|
1
|
+
import { ReadableStream as ReadableStream$1 } from 'stream/web';
|
|
2
2
|
import { Tracer, Span } from '@opentelemetry/api';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -176,10 +176,10 @@ type AxEmbedRequest = {
|
|
|
176
176
|
embedModel?: string;
|
|
177
177
|
};
|
|
178
178
|
type AxInternalEmbedRequest = Omit<AxEmbedRequest, 'embedModel'> & Required<Pick<AxEmbedRequest, 'embedModel'>>;
|
|
179
|
-
type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream<T>>, info: Readonly<{
|
|
179
|
+
type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream$1<T>>, info: Readonly<{
|
|
180
180
|
modelUsage?: AxTokenUsage;
|
|
181
181
|
embedModelUsage?: AxTokenUsage;
|
|
182
|
-
}>) => Promise<T | ReadableStream<T>>;
|
|
182
|
+
}>) => Promise<T | ReadableStream$1<T>>;
|
|
183
183
|
type AxAIPromptConfig = {
|
|
184
184
|
stream?: boolean;
|
|
185
185
|
};
|
|
@@ -205,7 +205,7 @@ interface AxAIService {
|
|
|
205
205
|
};
|
|
206
206
|
getModelMap(): AxAIModelMap | undefined;
|
|
207
207
|
getMetrics(): AxAIServiceMetrics;
|
|
208
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
208
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
209
209
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
210
210
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
211
211
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -267,7 +267,7 @@ declare class AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponse
|
|
|
267
267
|
private updateLatencyMetrics;
|
|
268
268
|
private updateErrorMetrics;
|
|
269
269
|
getMetrics(): AxAIServiceMetrics;
|
|
270
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
270
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
271
271
|
private _chat1;
|
|
272
272
|
private _chat2;
|
|
273
273
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
@@ -285,8 +285,15 @@ declare enum AxAIAnthropicModel {
|
|
|
285
285
|
Claude21 = "claude-2.1",
|
|
286
286
|
ClaudeInstant12 = "claude-instant-1.2"
|
|
287
287
|
}
|
|
288
|
+
declare enum AxAIAnthropicVertexModel {
|
|
289
|
+
Claude35Haiku = "claude-3-5-haiku",
|
|
290
|
+
Claude35Sonnet = "claude-3-5-sonnet",
|
|
291
|
+
Claude35SonnetV2 = "claude-3-5-sonnet-v2",
|
|
292
|
+
Claude3Haiku = "claude-3-haiku",
|
|
293
|
+
Claude3Opus = "claude-3-opus"
|
|
294
|
+
}
|
|
288
295
|
type AxAIAnthropicConfig = AxModelConfig & {
|
|
289
|
-
model: AxAIAnthropicModel;
|
|
296
|
+
model: AxAIAnthropicModel | AxAIAnthropicVertexModel;
|
|
290
297
|
};
|
|
291
298
|
type AxAIAnthropicChatRequestCacheParam = {
|
|
292
299
|
cache_control?: {
|
|
@@ -294,7 +301,8 @@ type AxAIAnthropicChatRequestCacheParam = {
|
|
|
294
301
|
};
|
|
295
302
|
};
|
|
296
303
|
type AxAIAnthropicChatRequest = {
|
|
297
|
-
model
|
|
304
|
+
model?: string;
|
|
305
|
+
anthropic_version?: string;
|
|
298
306
|
messages: ({
|
|
299
307
|
role: 'user';
|
|
300
308
|
content: string | (({
|
|
@@ -459,13 +467,15 @@ type AxAIAnthropicChatResponseDelta = AxAIAnthropicMessageStartEvent | AxAIAnthr
|
|
|
459
467
|
|
|
460
468
|
interface AxAIAnthropicArgs {
|
|
461
469
|
name: 'anthropic';
|
|
462
|
-
apiKey
|
|
470
|
+
apiKey?: string;
|
|
471
|
+
projectId?: string;
|
|
472
|
+
region?: string;
|
|
463
473
|
config?: Readonly<Partial<AxAIAnthropicConfig>>;
|
|
464
474
|
options?: Readonly<AxAIServiceOptions>;
|
|
465
475
|
modelMap?: Record<string, AxAIAnthropicModel | string>;
|
|
466
476
|
}
|
|
467
477
|
declare class AxAIAnthropic extends AxBaseAI<AxAIAnthropicChatRequest, unknown, AxAIAnthropicChatResponse, AxAIAnthropicChatResponseDelta, unknown> {
|
|
468
|
-
constructor({ apiKey, config, options, modelMap, }: Readonly<Omit<AxAIAnthropicArgs, 'name'>>);
|
|
478
|
+
constructor({ apiKey, projectId, region, config, options, modelMap, }: Readonly<Omit<AxAIAnthropicArgs, 'name'>>);
|
|
469
479
|
}
|
|
470
480
|
|
|
471
481
|
declare enum AxAIOpenAIModel {
|
|
@@ -991,7 +1001,6 @@ interface AxAIGoogleGeminiArgs {
|
|
|
991
1001
|
apiKey?: string;
|
|
992
1002
|
projectId?: string;
|
|
993
1003
|
region?: string;
|
|
994
|
-
keyFile?: string;
|
|
995
1004
|
config?: Readonly<Partial<AxAIGoogleGeminiConfig>>;
|
|
996
1005
|
options?: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>;
|
|
997
1006
|
modelMap?: Record<string, AxAIGoogleGeminiModel | AxAIGoogleGeminiEmbedModel | string>;
|
|
@@ -1000,7 +1009,7 @@ interface AxAIGoogleGeminiArgs {
|
|
|
1000
1009
|
* AxAIGoogleGemini: AI Service
|
|
1001
1010
|
*/
|
|
1002
1011
|
declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest | AxAIGoogleVertexBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse | AxAIGoogleVertexBatchEmbedResponse> {
|
|
1003
|
-
constructor({ apiKey, projectId, region,
|
|
1012
|
+
constructor({ apiKey, projectId, region, config, options, modelMap, }: Readonly<Omit<AxAIGoogleGeminiArgs, 'name'>>);
|
|
1004
1013
|
}
|
|
1005
1014
|
|
|
1006
1015
|
declare enum AxAIGroqModel {
|
|
@@ -1224,7 +1233,7 @@ declare class AxAI implements AxAIService {
|
|
|
1224
1233
|
};
|
|
1225
1234
|
getModelMap(): AxAIModelMap | undefined;
|
|
1226
1235
|
getMetrics(): AxAIServiceMetrics;
|
|
1227
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1236
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
1228
1237
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
1229
1238
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1230
1239
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -1322,6 +1331,12 @@ type AxProgramForwardOptions = {
|
|
|
1322
1331
|
functionCall?: AxChatRequest['functionCall'];
|
|
1323
1332
|
stopFunction?: string;
|
|
1324
1333
|
};
|
|
1334
|
+
type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
|
|
1335
|
+
type AxGenDeltaOut<OUT> = {
|
|
1336
|
+
version: number;
|
|
1337
|
+
delta: Partial<OUT>;
|
|
1338
|
+
};
|
|
1339
|
+
type AxGenStreamingOut<OUT> = AsyncGenerator<AxGenDeltaOut<OUT>, void | OUT, unknown>;
|
|
1325
1340
|
interface AxTunable {
|
|
1326
1341
|
setExamples: (examples: Readonly<AxProgramExamples>) => void;
|
|
1327
1342
|
setId: (id: string) => void;
|
|
@@ -1353,6 +1368,7 @@ declare class AxProgramWithSignature<IN extends AxGenIn, OUT extends AxGenOut> i
|
|
|
1353
1368
|
getSignature(): AxSignature;
|
|
1354
1369
|
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
1355
1370
|
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1371
|
+
streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
|
|
1356
1372
|
setId(id: string): void;
|
|
1357
1373
|
setParentId(parentId: string): void;
|
|
1358
1374
|
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
@@ -1370,6 +1386,7 @@ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxT
|
|
|
1370
1386
|
constructor();
|
|
1371
1387
|
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
1372
1388
|
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1389
|
+
streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
|
|
1373
1390
|
setId(id: string): void;
|
|
1374
1391
|
setParentId(parentId: string): void;
|
|
1375
1392
|
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
@@ -1460,7 +1477,7 @@ declare class AxPromptTemplate {
|
|
|
1460
1477
|
examples?: Record<string, AxFieldValue>[];
|
|
1461
1478
|
demos?: Record<string, AxFieldValue>[];
|
|
1462
1479
|
}>) => AxChatRequest["chatPrompt"];
|
|
1463
|
-
renderExtraFields: (extraFields: readonly AxIField[]) =>
|
|
1480
|
+
renderExtraFields: (extraFields: readonly AxIField[]) => ({
|
|
1464
1481
|
type: "text";
|
|
1465
1482
|
text: string;
|
|
1466
1483
|
cache?: boolean;
|
|
@@ -1517,6 +1534,15 @@ interface AxResponseHandlerArgs<T> {
|
|
|
1517
1534
|
traceId?: string;
|
|
1518
1535
|
functions?: Readonly<AxFunction[]>;
|
|
1519
1536
|
}
|
|
1537
|
+
interface AxStreamingEvent<T> {
|
|
1538
|
+
event: 'delta' | 'done' | 'error';
|
|
1539
|
+
data: {
|
|
1540
|
+
contentDelta?: string;
|
|
1541
|
+
partialValues?: Partial<T>;
|
|
1542
|
+
error?: string;
|
|
1543
|
+
functions?: AxChatResponseFunctionCall[];
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1520
1546
|
declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<AxGenOut> = AxGenerateResult<AxGenOut>> extends AxProgramWithSignature<IN, OUT> {
|
|
1521
1547
|
private promptTemplate;
|
|
1522
1548
|
private asserts;
|
|
@@ -1529,10 +1555,19 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
|
|
|
1529
1555
|
addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string, optional?: boolean) => void;
|
|
1530
1556
|
private forwardSendRequest;
|
|
1531
1557
|
private forwardCore;
|
|
1532
|
-
private
|
|
1558
|
+
private processStreamingResponse;
|
|
1533
1559
|
private processResponse;
|
|
1534
|
-
private
|
|
1560
|
+
private _forward2;
|
|
1561
|
+
private shouldContinueSteps;
|
|
1562
|
+
_forward1(ai: Readonly<AxAIService>, values: IN, options: Readonly<AxProgramForwardOptions>): AsyncGenerator<{
|
|
1563
|
+
version: number;
|
|
1564
|
+
delta: Partial<OUT>;
|
|
1565
|
+
}, void, unknown>;
|
|
1535
1566
|
forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1567
|
+
streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AsyncGenerator<{
|
|
1568
|
+
version: number;
|
|
1569
|
+
delta: Partial<OUT>;
|
|
1570
|
+
}, void, unknown>;
|
|
1536
1571
|
}
|
|
1537
1572
|
|
|
1538
1573
|
interface AxAgentic extends AxTunable, AxUsable {
|
|
@@ -1567,7 +1602,9 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
|
|
|
1567
1602
|
})[];
|
|
1568
1603
|
resetUsage(): void;
|
|
1569
1604
|
getFunction(): AxFunction;
|
|
1605
|
+
private init;
|
|
1570
1606
|
forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
1607
|
+
streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
|
|
1571
1608
|
}
|
|
1572
1609
|
|
|
1573
1610
|
interface AxApacheTikaArgs {
|
|
@@ -1621,7 +1658,7 @@ declare class AxBalancer implements AxAIService {
|
|
|
1621
1658
|
streaming: boolean;
|
|
1622
1659
|
};
|
|
1623
1660
|
getMetrics(): AxAIServiceMetrics;
|
|
1624
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1661
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
1625
1662
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions> | undefined): Promise<AxEmbedResponse>;
|
|
1626
1663
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1627
1664
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -2096,6 +2133,41 @@ declare class AxInstanceRegistry<T> {
|
|
|
2096
2133
|
[Symbol.iterator](): Generator<T, void, unknown>;
|
|
2097
2134
|
}
|
|
2098
2135
|
|
|
2136
|
+
declare class AxMockAIService implements AxAIService {
|
|
2137
|
+
private readonly config;
|
|
2138
|
+
private options;
|
|
2139
|
+
private metrics;
|
|
2140
|
+
constructor(config?: {
|
|
2141
|
+
name?: string;
|
|
2142
|
+
modelInfo?: Partial<AxModelInfoWithProvider>;
|
|
2143
|
+
embedModelInfo?: AxModelInfoWithProvider;
|
|
2144
|
+
features?: {
|
|
2145
|
+
functions?: boolean;
|
|
2146
|
+
streaming?: boolean;
|
|
2147
|
+
};
|
|
2148
|
+
modelMap?: AxAIModelMap;
|
|
2149
|
+
chatResponse?: AxChatResponse | ((req: Readonly<AxChatRequest>) => AxChatResponse | Promise<AxChatResponse>);
|
|
2150
|
+
embedResponse?: AxEmbedResponse | ((req: Readonly<AxEmbedRequest>) => AxEmbedResponse | Promise<AxEmbedResponse>);
|
|
2151
|
+
shouldError?: boolean;
|
|
2152
|
+
errorMessage?: string;
|
|
2153
|
+
latencyMs?: number;
|
|
2154
|
+
});
|
|
2155
|
+
getName(): string;
|
|
2156
|
+
getModelInfo(): Readonly<AxModelInfoWithProvider>;
|
|
2157
|
+
getEmbedModelInfo(): Readonly<AxModelInfoWithProvider> | undefined;
|
|
2158
|
+
getFeatures(_model?: string): {
|
|
2159
|
+
functions: boolean;
|
|
2160
|
+
streaming: boolean;
|
|
2161
|
+
};
|
|
2162
|
+
getModelMap(): AxAIModelMap | undefined;
|
|
2163
|
+
getMetrics(): AxAIServiceMetrics;
|
|
2164
|
+
chat(req: Readonly<AxChatRequest>, _options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
2165
|
+
embed(req: Readonly<AxEmbedRequest>, _options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
2166
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
2167
|
+
getOptions(): Readonly<AxAIServiceOptions>;
|
|
2168
|
+
private updateMetrics;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2099
2171
|
declare class AxRAG extends AxChainOfThought<{
|
|
2100
2172
|
context: string[];
|
|
2101
2173
|
question: string;
|
|
@@ -2116,4 +2188,4 @@ declare class AxRAG extends AxChainOfThought<{
|
|
|
2116
2188
|
}>;
|
|
2117
2189
|
}
|
|
2118
2190
|
|
|
2119
|
-
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, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, 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 };
|
|
2191
|
+
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, AxAIAnthropicVertexModel, 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, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, 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 AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMockAIService, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, 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, type AxStreamingEvent, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };
|