@ax-llm/ax 13.0.10 → 13.0.11
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 +37 -37
- package/index.cjs.map +1 -1
- package/index.d.cts +190 -171
- package/index.d.ts +190 -171
- package/index.js +38 -38
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -73,18 +73,18 @@ declare class AxAIRefusalError extends Error {
|
|
|
73
73
|
toString(): string;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
type AxAIInputModelList<TModel, TEmbedModel> = (AxAIModelListBase & {
|
|
76
|
+
type AxAIInputModelList<TModel, TEmbedModel, TModelKey> = (AxAIModelListBase<TModelKey> & {
|
|
77
77
|
isInternal?: boolean;
|
|
78
78
|
} & ({
|
|
79
79
|
model: TModel;
|
|
80
80
|
} | {
|
|
81
81
|
embedModel: TEmbedModel;
|
|
82
82
|
}))[];
|
|
83
|
-
type AxAIModelListBase = {
|
|
84
|
-
key:
|
|
83
|
+
type AxAIModelListBase<TModelKey> = {
|
|
84
|
+
key: TModelKey;
|
|
85
85
|
description: string;
|
|
86
86
|
};
|
|
87
|
-
type AxAIModelList = (AxAIModelListBase & ({
|
|
87
|
+
type AxAIModelList<TModelKey> = (AxAIModelListBase<TModelKey> & ({
|
|
88
88
|
model: string;
|
|
89
89
|
} | {
|
|
90
90
|
embedModel: string;
|
|
@@ -364,8 +364,8 @@ type AxAIServiceOptions = {
|
|
|
364
364
|
abortSignal?: AbortSignal;
|
|
365
365
|
logger?: AxLoggerFunction;
|
|
366
366
|
};
|
|
367
|
-
type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
|
|
368
|
-
ai?: Readonly<AxAIService<TModel, TEmbedModel>>;
|
|
367
|
+
type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown, TModelKey = string> = {
|
|
368
|
+
ai?: Readonly<AxAIService<TModel, TEmbedModel, TModelKey>>;
|
|
369
369
|
sessionId?: string;
|
|
370
370
|
traceId?: string | undefined;
|
|
371
371
|
timeout?: number;
|
|
@@ -378,18 +378,18 @@ type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
|
|
|
378
378
|
stepIndex?: number;
|
|
379
379
|
functionResultFormatter?: (result: unknown) => string;
|
|
380
380
|
};
|
|
381
|
-
interface AxAIService<TModel = unknown, TEmbedModel = unknown> {
|
|
381
|
+
interface AxAIService<TModel = unknown, TEmbedModel = unknown, TModelKey = string> {
|
|
382
382
|
getId(): string;
|
|
383
383
|
getName(): string;
|
|
384
384
|
getFeatures(model?: TModel): AxAIFeatures;
|
|
385
|
-
getModelList(): AxAIModelList | undefined;
|
|
385
|
+
getModelList(): AxAIModelList<TModelKey> | undefined;
|
|
386
386
|
getMetrics(): AxAIServiceMetrics;
|
|
387
387
|
getLogger(): AxLoggerFunction;
|
|
388
388
|
getLastUsedChatModel(): TModel | undefined;
|
|
389
389
|
getLastUsedEmbedModel(): TEmbedModel | undefined;
|
|
390
390
|
getLastUsedModelConfig(): AxModelConfig | undefined;
|
|
391
|
-
chat(req: Readonly<AxChatRequest<TModel>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<TModel, TEmbedModel>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
392
|
-
embed(req: Readonly<AxEmbedRequest<TEmbedModel>>, options?: Readonly<AxAIServiceActionOptions<TModel, TEmbedModel>>): Promise<AxEmbedResponse>;
|
|
391
|
+
chat(req: Readonly<AxChatRequest<TModel>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<TModel, TEmbedModel, TModelKey>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
392
|
+
embed(req: Readonly<AxEmbedRequest<TEmbedModel>>, options?: Readonly<AxAIServiceActionOptions<TModel, TEmbedModel, TModelKey>>): Promise<AxEmbedResponse>;
|
|
393
393
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
394
394
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
395
395
|
}
|
|
@@ -410,7 +410,7 @@ interface AxAIFeatures {
|
|
|
410
410
|
hasThinkingBudget?: boolean;
|
|
411
411
|
hasShowThoughts?: boolean;
|
|
412
412
|
}
|
|
413
|
-
interface AxBaseAIArgs<TModel, TEmbedModel> {
|
|
413
|
+
interface AxBaseAIArgs<TModel, TEmbedModel, TModelKey> {
|
|
414
414
|
name: string;
|
|
415
415
|
apiURL: string;
|
|
416
416
|
headers: () => Promise<Record<string, string>>;
|
|
@@ -421,11 +421,11 @@ interface AxBaseAIArgs<TModel, TEmbedModel> {
|
|
|
421
421
|
}>;
|
|
422
422
|
options?: Readonly<AxAIServiceOptions>;
|
|
423
423
|
supportFor: AxAIFeatures | ((model: TModel) => AxAIFeatures);
|
|
424
|
-
models?: AxAIInputModelList<TModel, TEmbedModel>;
|
|
424
|
+
models?: AxAIInputModelList<TModel, TEmbedModel, TModelKey>;
|
|
425
425
|
}
|
|
426
426
|
declare const axBaseAIDefaultConfig: () => AxModelConfig;
|
|
427
427
|
declare const axBaseAIDefaultCreativeConfig: () => AxModelConfig;
|
|
428
|
-
declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse> implements AxAIService<TModel, TEmbedModel> {
|
|
428
|
+
declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse, TModelKey> implements AxAIService<TModel, TEmbedModel, TModelKey> {
|
|
429
429
|
private readonly aiImpl;
|
|
430
430
|
private debug;
|
|
431
431
|
private rt?;
|
|
@@ -450,7 +450,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
|
|
|
450
450
|
protected headers: () => Promise<Record<string, string>>;
|
|
451
451
|
protected supportFor: AxAIFeatures | ((model: TModel) => AxAIFeatures);
|
|
452
452
|
private metrics;
|
|
453
|
-
constructor(aiImpl: Readonly<AxAIServiceImpl<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>, { name, apiURL, headers, modelInfo, defaults, options, supportFor, models, }: Readonly<AxBaseAIArgs<TModel, TEmbedModel>>);
|
|
453
|
+
constructor(aiImpl: Readonly<AxAIServiceImpl<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>, { name, apiURL, headers, modelInfo, defaults, options, supportFor, models, }: Readonly<AxBaseAIArgs<TModel, TEmbedModel, TModelKey>>);
|
|
454
454
|
private getMetricsInstruments;
|
|
455
455
|
setName(name: string): void;
|
|
456
456
|
getId(): string;
|
|
@@ -459,7 +459,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
|
|
|
459
459
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
460
460
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
461
461
|
getLogger(): AxLoggerFunction;
|
|
462
|
-
getModelList(): AxAIModelList
|
|
462
|
+
getModelList(): AxAIModelList<TModelKey>;
|
|
463
463
|
getName(): string;
|
|
464
464
|
getFeatures(model?: TModel): AxAIFeatures;
|
|
465
465
|
getLastUsedChatModel(): TModel | undefined;
|
|
@@ -482,11 +482,11 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
|
|
|
482
482
|
private recordChatMetrics;
|
|
483
483
|
private recordEmbedMetrics;
|
|
484
484
|
getMetrics(): AxAIServiceMetrics;
|
|
485
|
-
chat(req: Readonly<AxChatRequest<TModel>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<TModel, TEmbedModel>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
485
|
+
chat(req: Readonly<AxChatRequest<TModel>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<TModel, TEmbedModel, TModelKey>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
486
486
|
private _chat1;
|
|
487
487
|
private cleanupFunctionSchema;
|
|
488
488
|
private _chat2;
|
|
489
|
-
embed(req: Readonly<AxEmbedRequest<TEmbedModel>>, options?: Readonly<AxAIServiceActionOptions<TModel, TEmbedModel>>): Promise<AxEmbedResponse>;
|
|
489
|
+
embed(req: Readonly<AxEmbedRequest<TEmbedModel>>, options?: Readonly<AxAIServiceActionOptions<TModel, TEmbedModel, TModelKey>>): Promise<AxEmbedResponse>;
|
|
490
490
|
private _embed1;
|
|
491
491
|
private _embed2;
|
|
492
492
|
private buildHeaders;
|
|
@@ -729,17 +729,17 @@ type AxAIAnthropicChatResponseDelta = AxAIAnthropicMessageStartEvent | AxAIAnthr
|
|
|
729
729
|
|
|
730
730
|
declare const axAIAnthropicDefaultConfig: () => AxAIAnthropicConfig;
|
|
731
731
|
declare const axAIAnthropicVertexDefaultConfig: () => AxAIAnthropicConfig;
|
|
732
|
-
interface AxAIAnthropicArgs {
|
|
732
|
+
interface AxAIAnthropicArgs<TModelKey = string> {
|
|
733
733
|
name: 'anthropic';
|
|
734
734
|
apiKey?: string | (() => Promise<string>);
|
|
735
735
|
projectId?: string;
|
|
736
736
|
region?: string;
|
|
737
737
|
config?: Readonly<Partial<AxAIAnthropicConfig>>;
|
|
738
738
|
options?: Readonly<AxAIServiceOptions>;
|
|
739
|
-
models?: AxAIInputModelList<AxAIAnthropicModel | AxAIAnthropicVertexModel, undefined>;
|
|
739
|
+
models?: AxAIInputModelList<AxAIAnthropicModel | AxAIAnthropicVertexModel, undefined, TModelKey>;
|
|
740
740
|
}
|
|
741
|
-
declare class AxAIAnthropic extends AxBaseAI<AxAIAnthropicModel | AxAIAnthropicVertexModel, unknown, AxAIAnthropicChatRequest, unknown, AxAIAnthropicChatResponse, AxAIAnthropicChatResponseDelta, unknown> {
|
|
742
|
-
constructor({ apiKey, projectId, region, config, options, models, }: Readonly<Omit<AxAIAnthropicArgs
|
|
741
|
+
declare class AxAIAnthropic<TModelKey = string> extends AxBaseAI<AxAIAnthropicModel | AxAIAnthropicVertexModel, unknown, AxAIAnthropicChatRequest, unknown, AxAIAnthropicChatResponse, AxAIAnthropicChatResponseDelta, unknown, TModelKey> {
|
|
742
|
+
constructor({ apiKey, projectId, region, config, options, models, }: Readonly<Omit<AxAIAnthropicArgs<TModelKey>, 'name'>>);
|
|
743
743
|
}
|
|
744
744
|
|
|
745
745
|
declare const axModelInfoAnthropic: AxModelInfo[];
|
|
@@ -990,13 +990,13 @@ declare const axAIOpenAIDefaultConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, A
|
|
|
990
990
|
declare const axAIOpenAIBestConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
991
991
|
declare const axAIOpenAICreativeConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
992
992
|
declare const axAIOpenAIFastConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
993
|
-
interface AxAIOpenAIArgs<TName = 'openai', TModel = AxAIOpenAIModel, TEmbedModel = AxAIOpenAIEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>, 'config' | 'supportFor' | 'modelInfo'> {
|
|
993
|
+
interface AxAIOpenAIArgs<TName = 'openai', TModel = AxAIOpenAIModel, TEmbedModel = AxAIOpenAIEmbedModel, TModelKey = string, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq>, 'config' | 'supportFor' | 'modelInfo'> {
|
|
994
994
|
name: TName;
|
|
995
995
|
modelInfo?: AxModelInfo[];
|
|
996
|
-
config?: Partial<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>['config']>;
|
|
996
|
+
config?: Partial<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq>['config']>;
|
|
997
997
|
}
|
|
998
998
|
type ChatReqUpdater<TModel, TChatReq extends AxAIOpenAIChatRequest<TModel>> = (req: Readonly<TChatReq>) => TChatReq;
|
|
999
|
-
interface AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel>> {
|
|
999
|
+
interface AxAIOpenAIBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq extends AxAIOpenAIChatRequest<TModel>> {
|
|
1000
1000
|
apiKey: string;
|
|
1001
1001
|
apiURL?: string;
|
|
1002
1002
|
config: Readonly<AxAIOpenAIConfig<TModel, TEmbedModel>>;
|
|
@@ -1004,15 +1004,15 @@ interface AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq extends AxAIOpenAICha
|
|
|
1004
1004
|
streamingUsage?: boolean;
|
|
1005
1005
|
}>;
|
|
1006
1006
|
modelInfo: Readonly<AxModelInfo[]>;
|
|
1007
|
-
models?: AxAIInputModelList<TModel, TEmbedModel>;
|
|
1007
|
+
models?: AxAIInputModelList<TModel, TEmbedModel, TModelKey>;
|
|
1008
1008
|
chatReqUpdater?: ChatReqUpdater<TModel, TChatReq>;
|
|
1009
1009
|
supportFor: AxAIFeatures | ((model: TModel) => AxAIFeatures);
|
|
1010
1010
|
}
|
|
1011
|
-
declare class AxAIOpenAIBase<TModel, TEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIChatRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIChatResponse, AxAIOpenAIChatResponseDelta, AxAIOpenAIEmbedResponse> {
|
|
1012
|
-
constructor({ apiKey, config, options, apiURL, modelInfo, models, chatReqUpdater, supportFor, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>, 'name'>>);
|
|
1011
|
+
declare class AxAIOpenAIBase<TModel, TEmbedModel, TModelKey, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIChatRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIChatResponse, AxAIOpenAIChatResponseDelta, AxAIOpenAIEmbedResponse, TModelKey> {
|
|
1012
|
+
constructor({ apiKey, config, options, apiURL, modelInfo, models, chatReqUpdater, supportFor, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq>, 'name'>>);
|
|
1013
1013
|
}
|
|
1014
|
-
declare class AxAIOpenAI extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel> {
|
|
1015
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIArgs, 'name'>>);
|
|
1014
|
+
declare class AxAIOpenAI<TModelKey = string> extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey> {
|
|
1015
|
+
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIArgs<'openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey>, 'name'>>);
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
1018
|
declare const axAIAzureOpenAIDefaultConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
@@ -1020,20 +1020,20 @@ declare const axAIAzureOpenAICreativeConfig: () => AxAIOpenAIConfig<AxAIOpenAIMo
|
|
|
1020
1020
|
declare const axAIAzureOpenAIFastConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
1021
1021
|
declare const axAIAzureOpenAIBestConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
1022
1022
|
type AxAIAzureOpenAIConfig = AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
1023
|
-
type AxAIAzureOpenAIArgs = AxAIOpenAIArgs<'azure-openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel> & {
|
|
1023
|
+
type AxAIAzureOpenAIArgs<TModelKey = string> = AxAIOpenAIArgs<'azure-openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey> & {
|
|
1024
1024
|
resourceName: string;
|
|
1025
1025
|
deploymentName: string;
|
|
1026
1026
|
version?: string;
|
|
1027
1027
|
};
|
|
1028
|
-
declare class AxAIAzureOpenAI extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel> {
|
|
1029
|
-
constructor({ apiKey, resourceName, deploymentName, version, config, options, models, modelInfo, }: Readonly<Omit<AxAIAzureOpenAIArgs
|
|
1028
|
+
declare class AxAIAzureOpenAI<TModelKey = string> extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey> {
|
|
1029
|
+
constructor({ apiKey, resourceName, deploymentName, version, config, options, models, modelInfo, }: Readonly<Omit<AxAIAzureOpenAIArgs<TModelKey>, 'name'>>);
|
|
1030
1030
|
}
|
|
1031
1031
|
|
|
1032
1032
|
/**
|
|
1033
1033
|
* Options for the balancer.
|
|
1034
1034
|
*/
|
|
1035
|
-
type AxBalancerOptions = {
|
|
1036
|
-
comparator?: (a: AxAIService, b: AxAIService) => number;
|
|
1035
|
+
type AxBalancerOptions<TModelKey = string> = {
|
|
1036
|
+
comparator?: (a: AxAIService<unknown, unknown, TModelKey>, b: AxAIService<unknown, unknown, TModelKey>) => number;
|
|
1037
1037
|
debug?: boolean;
|
|
1038
1038
|
initialBackoffMs?: number;
|
|
1039
1039
|
maxBackoffMs?: number;
|
|
@@ -1042,7 +1042,7 @@ type AxBalancerOptions = {
|
|
|
1042
1042
|
/**
|
|
1043
1043
|
* Balancer that rotates through services.
|
|
1044
1044
|
*/
|
|
1045
|
-
declare class AxBalancer implements AxAIService<unknown, unknown> {
|
|
1045
|
+
declare class AxBalancer<TModelKey = string> implements AxAIService<unknown, unknown, TModelKey> {
|
|
1046
1046
|
private services;
|
|
1047
1047
|
private currentServiceIndex;
|
|
1048
1048
|
private currentService;
|
|
@@ -1051,7 +1051,7 @@ declare class AxBalancer implements AxAIService<unknown, unknown> {
|
|
|
1051
1051
|
private maxBackoffMs;
|
|
1052
1052
|
private maxRetries;
|
|
1053
1053
|
private serviceFailures;
|
|
1054
|
-
constructor(services: readonly AxAIService[], options?: AxBalancerOptions);
|
|
1054
|
+
constructor(services: readonly AxAIService<unknown, unknown, TModelKey>[], options?: AxBalancerOptions<TModelKey>);
|
|
1055
1055
|
getLastUsedChatModel(): unknown;
|
|
1056
1056
|
getLastUsedEmbedModel(): unknown;
|
|
1057
1057
|
getLastUsedModelConfig(): AxModelConfig | undefined;
|
|
@@ -1062,8 +1062,8 @@ declare class AxBalancer implements AxAIService<unknown, unknown> {
|
|
|
1062
1062
|
/**
|
|
1063
1063
|
* Service comparator that sorts services by cost.
|
|
1064
1064
|
*/
|
|
1065
|
-
static metricComparator: (a: AxAIService, b: AxAIService) => number;
|
|
1066
|
-
getModelList(): AxAIModelList | undefined;
|
|
1065
|
+
static metricComparator: <TModelKey_1 = string>(a: AxAIService<unknown, unknown, TModelKey_1>, b: AxAIService<unknown, unknown, TModelKey_1>) => number;
|
|
1066
|
+
getModelList(): AxAIModelList<TModelKey> | undefined;
|
|
1067
1067
|
private getNextService;
|
|
1068
1068
|
private reset;
|
|
1069
1069
|
getName(): string;
|
|
@@ -1073,8 +1073,8 @@ declare class AxBalancer implements AxAIService<unknown, unknown> {
|
|
|
1073
1073
|
private canRetryService;
|
|
1074
1074
|
private handleFailure;
|
|
1075
1075
|
private handleSuccess;
|
|
1076
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions
|
|
1077
|
-
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions
|
|
1076
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown, TModelKey>> | undefined): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1077
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions<unknown, unknown, TModelKey>> | undefined): Promise<AxEmbedResponse>;
|
|
1078
1078
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1079
1079
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
1080
1080
|
getLogger(): AxLoggerFunction;
|
|
@@ -1181,15 +1181,15 @@ type AxAICohereEmbedResponse = {
|
|
|
1181
1181
|
|
|
1182
1182
|
declare const axAICohereDefaultConfig: () => AxAICohereConfig;
|
|
1183
1183
|
declare const axAICohereCreativeConfig: () => AxAICohereConfig;
|
|
1184
|
-
interface AxAICohereArgs {
|
|
1184
|
+
interface AxAICohereArgs<TModelKey = string> {
|
|
1185
1185
|
name: 'cohere';
|
|
1186
1186
|
apiKey: string;
|
|
1187
1187
|
config?: Readonly<Partial<AxAICohereConfig>>;
|
|
1188
1188
|
options?: Readonly<AxAIServiceOptions>;
|
|
1189
|
-
models?: AxAIInputModelList<AxAICohereModel, AxAICohereEmbedModel>;
|
|
1189
|
+
models?: AxAIInputModelList<AxAICohereModel, AxAICohereEmbedModel, TModelKey>;
|
|
1190
1190
|
}
|
|
1191
|
-
declare class AxAICohere extends AxBaseAI<AxAICohereModel, AxAICohereEmbedModel, AxAICohereChatRequest, AxAICohereEmbedRequest, AxAICohereChatResponse, AxAICohereChatResponseDelta, AxAICohereEmbedResponse> {
|
|
1192
|
-
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAICohereArgs
|
|
1191
|
+
declare class AxAICohere<TModelKey = string> extends AxBaseAI<AxAICohereModel, AxAICohereEmbedModel, AxAICohereChatRequest, AxAICohereEmbedRequest, AxAICohereChatResponse, AxAICohereChatResponseDelta, AxAICohereEmbedResponse, TModelKey> {
|
|
1192
|
+
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAICohereArgs<TModelKey>, 'name'>>);
|
|
1193
1193
|
}
|
|
1194
1194
|
|
|
1195
1195
|
declare const axModelInfoCohere: AxModelInfo[];
|
|
@@ -1206,9 +1206,9 @@ declare enum AxAIDeepSeekModel {
|
|
|
1206
1206
|
type DeepSeekConfig = AxAIOpenAIConfig<AxAIDeepSeekModel, undefined>;
|
|
1207
1207
|
declare const axAIDeepSeekDefaultConfig: () => DeepSeekConfig;
|
|
1208
1208
|
declare const axAIDeepSeekCodeConfig: () => DeepSeekConfig;
|
|
1209
|
-
type AxAIDeepSeekArgs = AxAIOpenAIArgs<'deepseek', AxAIDeepSeekModel, undefined>;
|
|
1210
|
-
declare class AxAIDeepSeek extends AxAIOpenAIBase<AxAIDeepSeekModel, undefined> {
|
|
1211
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIDeepSeekArgs
|
|
1209
|
+
type AxAIDeepSeekArgs<TModelKey = string> = AxAIOpenAIArgs<'deepseek', AxAIDeepSeekModel, undefined, TModelKey>;
|
|
1210
|
+
declare class AxAIDeepSeek<TModelKey = string> extends AxAIOpenAIBase<AxAIDeepSeekModel, undefined, TModelKey> {
|
|
1211
|
+
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIDeepSeekArgs<TModelKey>, 'name'>>);
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
1214
|
declare const axModelInfoDeepSeek: AxModelInfo[];
|
|
@@ -1451,7 +1451,7 @@ interface AxAIGoogleGeminiOptionsTools {
|
|
|
1451
1451
|
googleSearch?: boolean;
|
|
1452
1452
|
urlContext?: boolean;
|
|
1453
1453
|
}
|
|
1454
|
-
interface AxAIGoogleGeminiArgs {
|
|
1454
|
+
interface AxAIGoogleGeminiArgs<TModelKey = string> {
|
|
1455
1455
|
name: 'google-gemini';
|
|
1456
1456
|
apiKey?: string | (() => Promise<string>);
|
|
1457
1457
|
projectId?: string;
|
|
@@ -1459,14 +1459,14 @@ interface AxAIGoogleGeminiArgs {
|
|
|
1459
1459
|
endpointId?: string;
|
|
1460
1460
|
config?: Readonly<Partial<AxAIGoogleGeminiConfig>>;
|
|
1461
1461
|
options?: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>;
|
|
1462
|
-
models?: AxAIInputModelList<AxAIGoogleGeminiModel, AxAIGoogleGeminiEmbedModel>;
|
|
1462
|
+
models?: AxAIInputModelList<AxAIGoogleGeminiModel, AxAIGoogleGeminiEmbedModel, TModelKey>;
|
|
1463
1463
|
modelInfo?: AxModelInfo[];
|
|
1464
1464
|
}
|
|
1465
1465
|
/**
|
|
1466
1466
|
* AxAIGoogleGemini: AI Service
|
|
1467
1467
|
*/
|
|
1468
|
-
declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiModel, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest | AxAIGoogleVertexBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse | AxAIGoogleVertexBatchEmbedResponse> {
|
|
1469
|
-
constructor({ apiKey, projectId, region, endpointId, config, options, models, modelInfo, }: Readonly<Omit<AxAIGoogleGeminiArgs
|
|
1468
|
+
declare class AxAIGoogleGemini<TModelKey = string> extends AxBaseAI<AxAIGoogleGeminiModel, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest | AxAIGoogleVertexBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse | AxAIGoogleVertexBatchEmbedResponse, TModelKey> {
|
|
1469
|
+
constructor({ apiKey, projectId, region, endpointId, config, options, models, modelInfo, }: Readonly<Omit<AxAIGoogleGeminiArgs<TModelKey>, 'name'>>);
|
|
1470
1470
|
}
|
|
1471
1471
|
|
|
1472
1472
|
/**
|
|
@@ -1481,14 +1481,14 @@ declare enum AxAIGroqModel {
|
|
|
1481
1481
|
Gemma2_9B = "gemma2-9b-it"
|
|
1482
1482
|
}
|
|
1483
1483
|
|
|
1484
|
-
type AxAIGroqArgs = AxAIOpenAIArgs<'groq', AxAIGroqModel, undefined> & {
|
|
1484
|
+
type AxAIGroqArgs<TModelKey = string> = AxAIOpenAIArgs<'groq', AxAIGroqModel, undefined, TModelKey> & {
|
|
1485
1485
|
options?: Readonly<AxAIServiceOptions> & {
|
|
1486
1486
|
tokensPerMinute?: number;
|
|
1487
1487
|
};
|
|
1488
1488
|
modelInfo?: AxModelInfo[];
|
|
1489
1489
|
};
|
|
1490
|
-
declare class AxAIGroq extends AxAIOpenAIBase<AxAIGroqModel, undefined> {
|
|
1491
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIGroqArgs
|
|
1490
|
+
declare class AxAIGroq<TModelKey = string> extends AxAIOpenAIBase<AxAIGroqModel, undefined, TModelKey> {
|
|
1491
|
+
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIGroqArgs<TModelKey>, 'name'>>);
|
|
1492
1492
|
setOptions: (options: Readonly<AxAIServiceOptions>) => void;
|
|
1493
1493
|
private newRateLimiter;
|
|
1494
1494
|
}
|
|
@@ -1534,15 +1534,15 @@ type AxAIHuggingFaceResponse = {
|
|
|
1534
1534
|
|
|
1535
1535
|
declare const axAIHuggingFaceDefaultConfig: () => AxAIHuggingFaceConfig;
|
|
1536
1536
|
declare const axAIHuggingFaceCreativeConfig: () => AxAIHuggingFaceConfig;
|
|
1537
|
-
interface AxAIHuggingFaceArgs {
|
|
1537
|
+
interface AxAIHuggingFaceArgs<TModelKey = string> {
|
|
1538
1538
|
name: 'huggingface';
|
|
1539
1539
|
apiKey: string;
|
|
1540
1540
|
config?: Readonly<Partial<AxAIHuggingFaceConfig>>;
|
|
1541
1541
|
options?: Readonly<AxAIServiceOptions>;
|
|
1542
|
-
models?: AxAIInputModelList<AxAIHuggingFaceModel, undefined>;
|
|
1542
|
+
models?: AxAIInputModelList<AxAIHuggingFaceModel, undefined, TModelKey>;
|
|
1543
1543
|
}
|
|
1544
|
-
declare class AxAIHuggingFace extends AxBaseAI<AxAIHuggingFaceModel, unknown, AxAIHuggingFaceRequest, unknown, AxAIHuggingFaceResponse, unknown, unknown> {
|
|
1545
|
-
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAIHuggingFaceArgs
|
|
1544
|
+
declare class AxAIHuggingFace<TModelKey = string> extends AxBaseAI<AxAIHuggingFaceModel, unknown, AxAIHuggingFaceRequest, unknown, AxAIHuggingFaceResponse, unknown, unknown, TModelKey> {
|
|
1545
|
+
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAIHuggingFaceArgs<TModelKey>, 'name'>>);
|
|
1546
1546
|
}
|
|
1547
1547
|
|
|
1548
1548
|
/**
|
|
@@ -1626,20 +1626,20 @@ type AxAIMistralChatRequest = Omit<AxAIOpenAIChatRequest<AxAIMistralModel>, 'max
|
|
|
1626
1626
|
tool_call_id: string;
|
|
1627
1627
|
})[];
|
|
1628
1628
|
};
|
|
1629
|
-
type AxAIMistralArgs = AxAIOpenAIArgs<'mistral', AxAIMistralModel, AxAIMistralEmbedModels> & {
|
|
1629
|
+
type AxAIMistralArgs<TModelKey = string> = AxAIOpenAIArgs<'mistral', AxAIMistralModel, AxAIMistralEmbedModels, TModelKey> & {
|
|
1630
1630
|
options?: Readonly<AxAIServiceOptions> & {
|
|
1631
1631
|
tokensPerMinute?: number;
|
|
1632
1632
|
};
|
|
1633
1633
|
modelInfo?: AxModelInfo[];
|
|
1634
1634
|
};
|
|
1635
|
-
declare class AxAIMistral extends AxAIOpenAIBase<AxAIMistralModel, AxAIMistralEmbedModels> {
|
|
1636
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIMistralArgs
|
|
1635
|
+
declare class AxAIMistral<TModelKey = string> extends AxAIOpenAIBase<AxAIMistralModel, AxAIMistralEmbedModels, TModelKey> {
|
|
1636
|
+
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIMistralArgs<TModelKey>, 'name'>>);
|
|
1637
1637
|
private updateMessages;
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
1640
|
declare const axModelInfoMistral: AxModelInfo[];
|
|
1641
1641
|
|
|
1642
|
-
type AxMockAIServiceConfig = {
|
|
1642
|
+
type AxMockAIServiceConfig<TModelKey = string> = {
|
|
1643
1643
|
name?: string;
|
|
1644
1644
|
id?: string;
|
|
1645
1645
|
modelInfo?: Partial<AxModelInfoWithProvider>;
|
|
@@ -1648,7 +1648,7 @@ type AxMockAIServiceConfig = {
|
|
|
1648
1648
|
functions?: boolean;
|
|
1649
1649
|
streaming?: boolean;
|
|
1650
1650
|
};
|
|
1651
|
-
models?: AxAIModelList
|
|
1651
|
+
models?: AxAIModelList<TModelKey>;
|
|
1652
1652
|
options?: AxAIServiceOptions;
|
|
1653
1653
|
chatResponse?: AxChatResponse | ReadableStream<AxChatResponse> | (() => Promise<AxChatResponse | ReadableStream<AxChatResponse>>) | ((req: Readonly<AxChatRequest<unknown>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown>>) => Promise<AxChatResponse | ReadableStream<AxChatResponse>>);
|
|
1654
1654
|
embedResponse?: AxEmbedResponse | ((req: Readonly<AxEmbedRequest>) => AxEmbedResponse | Promise<AxEmbedResponse>);
|
|
@@ -1656,10 +1656,10 @@ type AxMockAIServiceConfig = {
|
|
|
1656
1656
|
errorMessage?: string;
|
|
1657
1657
|
latencyMs?: number;
|
|
1658
1658
|
};
|
|
1659
|
-
declare class AxMockAIService implements AxAIService {
|
|
1659
|
+
declare class AxMockAIService<TModelKey = string> implements AxAIService<unknown, unknown, TModelKey> {
|
|
1660
1660
|
private readonly config;
|
|
1661
1661
|
private metrics;
|
|
1662
|
-
constructor(config?: AxMockAIServiceConfig);
|
|
1662
|
+
constructor(config?: AxMockAIServiceConfig<TModelKey>);
|
|
1663
1663
|
getLastUsedChatModel(): unknown;
|
|
1664
1664
|
getLastUsedEmbedModel(): unknown;
|
|
1665
1665
|
getLastUsedModelConfig(): AxModelConfig | undefined;
|
|
@@ -1669,23 +1669,23 @@ declare class AxMockAIService implements AxAIService {
|
|
|
1669
1669
|
functions: boolean;
|
|
1670
1670
|
streaming: boolean;
|
|
1671
1671
|
};
|
|
1672
|
-
getModelList(): AxAIModelList | undefined;
|
|
1672
|
+
getModelList(): AxAIModelList<TModelKey> | undefined;
|
|
1673
1673
|
getMetrics(): AxAIServiceMetrics;
|
|
1674
|
-
chat(req: Readonly<AxChatRequest<unknown>>, _options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1675
|
-
embed(req: Readonly<AxEmbedRequest>, _options?: Readonly<AxAIServiceActionOptions
|
|
1674
|
+
chat(req: Readonly<AxChatRequest<unknown>>, _options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown, TModelKey>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1675
|
+
embed(req: Readonly<AxEmbedRequest>, _options?: Readonly<AxAIServiceActionOptions<unknown, unknown, TModelKey>>): Promise<AxEmbedResponse>;
|
|
1676
1676
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1677
1677
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
1678
1678
|
getLogger(): AxLoggerFunction;
|
|
1679
1679
|
private updateMetrics;
|
|
1680
1680
|
}
|
|
1681
1681
|
|
|
1682
|
-
type AxAIServiceListItem<TModel = unknown, TEmbedModel = unknown> = {
|
|
1683
|
-
key:
|
|
1684
|
-
service: AxAIService<TModel, TEmbedModel>;
|
|
1682
|
+
type AxAIServiceListItem<TModel = unknown, TEmbedModel = unknown, TModelKey = string> = {
|
|
1683
|
+
key: TModelKey;
|
|
1684
|
+
service: AxAIService<TModel, TEmbedModel, TModelKey>;
|
|
1685
1685
|
description: string;
|
|
1686
1686
|
isInternal?: boolean;
|
|
1687
1687
|
};
|
|
1688
|
-
declare class AxMultiServiceRouter implements AxAIService<
|
|
1688
|
+
declare class AxMultiServiceRouter<TModelKey = string> implements AxAIService<unknown, unknown, TModelKey> {
|
|
1689
1689
|
private options?;
|
|
1690
1690
|
private lastUsedService?;
|
|
1691
1691
|
private services;
|
|
@@ -1694,18 +1694,18 @@ declare class AxMultiServiceRouter implements AxAIService<string, string> {
|
|
|
1694
1694
|
* It validates that each service provides a unique set of model keys,
|
|
1695
1695
|
* then builds a lookup (map) for routing the chat/embed requests.
|
|
1696
1696
|
*/
|
|
1697
|
-
constructor(services: (AxAIServiceListItem<
|
|
1698
|
-
getLastUsedChatModel():
|
|
1699
|
-
getLastUsedEmbedModel():
|
|
1697
|
+
constructor(services: (AxAIServiceListItem<unknown, unknown, TModelKey> | AxAIService<unknown, unknown, TModelKey>)[]);
|
|
1698
|
+
getLastUsedChatModel(): unknown | undefined;
|
|
1699
|
+
getLastUsedEmbedModel(): unknown | undefined;
|
|
1700
1700
|
getLastUsedModelConfig(): AxModelConfig | undefined;
|
|
1701
1701
|
/**
|
|
1702
1702
|
* Delegates the chat call to the service matching the provided model key.
|
|
1703
1703
|
*/
|
|
1704
|
-
chat(req: Readonly<AxChatRequest<string>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<
|
|
1704
|
+
chat(req: Readonly<AxChatRequest<string>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown, TModelKey>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1705
1705
|
/**
|
|
1706
1706
|
* Delegates the embed call to the service matching the provided embed model key.
|
|
1707
1707
|
*/
|
|
1708
|
-
embed(req: Readonly<AxEmbedRequest<string>>, options?: Readonly<AxAIServiceActionOptions<
|
|
1708
|
+
embed(req: Readonly<AxEmbedRequest<string>>, options?: Readonly<AxAIServiceActionOptions<unknown, unknown, TModelKey>>): Promise<AxEmbedResponse>;
|
|
1709
1709
|
/**
|
|
1710
1710
|
* Returns a composite ID built from the IDs of the underlying services.
|
|
1711
1711
|
*/
|
|
@@ -1717,12 +1717,12 @@ declare class AxMultiServiceRouter implements AxAIService<string, string> {
|
|
|
1717
1717
|
/**
|
|
1718
1718
|
* Aggregates all available models across the underlying services.
|
|
1719
1719
|
*/
|
|
1720
|
-
getModelList(): AxAIModelList
|
|
1720
|
+
getModelList(): AxAIModelList<TModelKey>;
|
|
1721
1721
|
/**
|
|
1722
1722
|
* If a model key is provided, delegate to the corresponding service's features.
|
|
1723
1723
|
* Otherwise, returns a default feature set.
|
|
1724
1724
|
*/
|
|
1725
|
-
getFeatures(model?:
|
|
1725
|
+
getFeatures(model?: TModelKey): {
|
|
1726
1726
|
functions: boolean;
|
|
1727
1727
|
streaming: boolean;
|
|
1728
1728
|
functionCot?: boolean;
|
|
@@ -1752,19 +1752,19 @@ declare class AxMultiServiceRouter implements AxAIService<string, string> {
|
|
|
1752
1752
|
* @param key - The model key
|
|
1753
1753
|
* @param entry - The service entry to set
|
|
1754
1754
|
*/
|
|
1755
|
-
setServiceEntry(key:
|
|
1755
|
+
setServiceEntry(key: TModelKey, entry: {
|
|
1756
1756
|
isInternal?: boolean;
|
|
1757
1757
|
description: string;
|
|
1758
1758
|
model?: string;
|
|
1759
1759
|
embedModel?: string;
|
|
1760
|
-
service: AxAIService<
|
|
1760
|
+
service: AxAIService<unknown, unknown, TModelKey>;
|
|
1761
1761
|
}): void;
|
|
1762
1762
|
}
|
|
1763
1763
|
|
|
1764
1764
|
type AxAIOllamaAIConfig = AxAIOpenAIConfig<string, string>;
|
|
1765
1765
|
declare const axAIOllamaDefaultConfig: () => AxAIOllamaAIConfig;
|
|
1766
1766
|
declare const axAIOllamaDefaultCreativeConfig: () => AxAIOllamaAIConfig;
|
|
1767
|
-
type AxAIOllamaArgs = AxAIOpenAIArgs<'ollama', string, string> & {
|
|
1767
|
+
type AxAIOllamaArgs<TModelKey = string> = AxAIOpenAIArgs<'ollama', string, string, TModelKey> & {
|
|
1768
1768
|
model?: string;
|
|
1769
1769
|
embedModel?: string;
|
|
1770
1770
|
url?: string;
|
|
@@ -1772,8 +1772,8 @@ type AxAIOllamaArgs = AxAIOpenAIArgs<'ollama', string, string> & {
|
|
|
1772
1772
|
/**
|
|
1773
1773
|
* OllamaAI: AI Service
|
|
1774
1774
|
*/
|
|
1775
|
-
declare class AxAIOllama extends AxAIOpenAIBase<string, string> {
|
|
1776
|
-
constructor({ apiKey, url, config, options, models, }: Readonly<Omit<AxAIOllamaArgs
|
|
1775
|
+
declare class AxAIOllama<TModelKey = string> extends AxAIOpenAIBase<string, string, TModelKey> {
|
|
1776
|
+
constructor({ apiKey, url, config, options, models, }: Readonly<Omit<AxAIOllamaArgs<TModelKey>, 'name'>>);
|
|
1777
1777
|
}
|
|
1778
1778
|
|
|
1779
1779
|
/**
|
|
@@ -2302,7 +2302,7 @@ Readonly<AxAIOpenAIEmbedResponse>> {
|
|
|
2302
2302
|
declare const axAIOpenAIResponsesDefaultConfig: () => AxAIOpenAIResponsesConfig<AxAIOpenAIResponsesModel, AxAIOpenAIEmbedModel>;
|
|
2303
2303
|
declare const axAIOpenAIResponsesBestConfig: () => AxAIOpenAIResponsesConfig<AxAIOpenAIResponsesModel, AxAIOpenAIEmbedModel>;
|
|
2304
2304
|
declare const axAIOpenAIResponsesCreativeConfig: () => AxAIOpenAIResponsesConfig<AxAIOpenAIResponsesModel, AxAIOpenAIEmbedModel>;
|
|
2305
|
-
interface AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TResponsesReq extends AxAIOpenAIResponsesRequest<TModel>> {
|
|
2305
|
+
interface AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TModelKey, TResponsesReq extends AxAIOpenAIResponsesRequest<TModel>> {
|
|
2306
2306
|
apiKey: string;
|
|
2307
2307
|
config: AxAIOpenAIResponsesConfig<TModel, TEmbedModel>;
|
|
2308
2308
|
options?: {
|
|
@@ -2310,27 +2310,27 @@ interface AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TResponsesReq extends
|
|
|
2310
2310
|
} & AxAIServiceOptions;
|
|
2311
2311
|
apiURL?: string;
|
|
2312
2312
|
modelInfo?: ReadonlyArray<AxModelInfo>;
|
|
2313
|
-
models?: AxAIInputModelList<TModel, TEmbedModel>;
|
|
2313
|
+
models?: AxAIInputModelList<TModel, TEmbedModel, TModelKey>;
|
|
2314
2314
|
responsesReqUpdater?: (req: Readonly<TResponsesReq>) => Readonly<TResponsesReq>;
|
|
2315
2315
|
supportFor?: AxAIFeatures | ((model: TModel) => AxAIFeatures);
|
|
2316
2316
|
}
|
|
2317
2317
|
/**
|
|
2318
2318
|
* Base class for OpenAI AI services using the /v1/responses API endpoint
|
|
2319
2319
|
*/
|
|
2320
|
-
declare class AxAIOpenAIResponsesBase<TModel, TEmbedModel, TResponsesReq extends AxAIOpenAIResponsesRequest<TModel>> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIResponsesRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIResponsesResponse, AxAIOpenAIResponsesResponseDelta, AxAIOpenAIEmbedResponse> {
|
|
2321
|
-
constructor({ apiKey, config, options, apiURL, modelInfo, models, responsesReqUpdater, supportFor, }: Readonly<AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TResponsesReq>>);
|
|
2320
|
+
declare class AxAIOpenAIResponsesBase<TModel, TEmbedModel, TModelKey, TResponsesReq extends AxAIOpenAIResponsesRequest<TModel>> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIResponsesRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIResponsesResponse, AxAIOpenAIResponsesResponseDelta, AxAIOpenAIEmbedResponse, TModelKey> {
|
|
2321
|
+
constructor({ apiKey, config, options, apiURL, modelInfo, models, responsesReqUpdater, supportFor, }: Readonly<AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TModelKey, TResponsesReq>>);
|
|
2322
2322
|
}
|
|
2323
2323
|
/**
|
|
2324
2324
|
* Ready-to-use implementation of the OpenAI Responses API client
|
|
2325
2325
|
* This class uses OpenAI's /v1/responses API endpoint which supports text, image, and audio inputs
|
|
2326
2326
|
*/
|
|
2327
|
-
interface AxAIOpenAIResponsesArgs<TName = 'openai-responses', TModel = AxAIOpenAIResponsesModel, TEmbedModel = AxAIOpenAIEmbedModel, TChatReq extends AxAIOpenAIResponsesRequest<TModel> = AxAIOpenAIResponsesRequest<TModel>> extends Omit<AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TChatReq>, 'config' | 'supportFor' | 'modelInfo'> {
|
|
2327
|
+
interface AxAIOpenAIResponsesArgs<TName = 'openai-responses', TModel = AxAIOpenAIResponsesModel, TEmbedModel = AxAIOpenAIEmbedModel, TModelKey = string, TChatReq extends AxAIOpenAIResponsesRequest<TModel> = AxAIOpenAIResponsesRequest<TModel>> extends Omit<AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq>, 'config' | 'supportFor' | 'modelInfo'> {
|
|
2328
2328
|
name: TName;
|
|
2329
2329
|
modelInfo?: AxModelInfo[];
|
|
2330
|
-
config?: Partial<AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TChatReq>['config']>;
|
|
2330
|
+
config?: Partial<AxAIOpenAIResponsesBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq>['config']>;
|
|
2331
2331
|
}
|
|
2332
|
-
declare class AxAIOpenAIResponses extends AxAIOpenAIResponsesBase<AxAIOpenAIResponsesModel, AxAIOpenAIEmbedModel, AxAIOpenAIResponsesRequest<AxAIOpenAIResponsesModel>> {
|
|
2333
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIResponsesArgs, 'name'>>);
|
|
2332
|
+
declare class AxAIOpenAIResponses<TModelKey = string> extends AxAIOpenAIResponsesBase<AxAIOpenAIResponsesModel, AxAIOpenAIEmbedModel, TModelKey, AxAIOpenAIResponsesRequest<AxAIOpenAIResponsesModel>> {
|
|
2333
|
+
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIResponsesArgs<'openai-responses', AxAIOpenAIResponsesModel, AxAIOpenAIEmbedModel, TModelKey>, 'name'>>);
|
|
2334
2334
|
}
|
|
2335
2335
|
|
|
2336
2336
|
declare enum AxAIRekaModel {
|
|
@@ -2404,7 +2404,7 @@ declare const axAIRekaDefaultConfig: () => AxAIRekaConfig;
|
|
|
2404
2404
|
declare const axAIRekaBestConfig: () => AxAIRekaConfig;
|
|
2405
2405
|
declare const axAIRekaCreativeConfig: () => AxAIRekaConfig;
|
|
2406
2406
|
declare const axAIRekaFastConfig: () => AxAIRekaConfig;
|
|
2407
|
-
interface AxAIRekaArgs {
|
|
2407
|
+
interface AxAIRekaArgs<TModelKey = string> {
|
|
2408
2408
|
name: 'reka';
|
|
2409
2409
|
apiKey: string;
|
|
2410
2410
|
apiURL?: string;
|
|
@@ -2413,10 +2413,10 @@ interface AxAIRekaArgs {
|
|
|
2413
2413
|
streamingUsage?: boolean;
|
|
2414
2414
|
}>;
|
|
2415
2415
|
modelInfo?: Readonly<AxModelInfo[]>;
|
|
2416
|
-
models?: AxAIInputModelList<AxAIRekaModel, undefined>;
|
|
2416
|
+
models?: AxAIInputModelList<AxAIRekaModel, undefined, TModelKey>;
|
|
2417
2417
|
}
|
|
2418
|
-
declare class AxAIReka extends AxBaseAI<AxAIRekaModel, undefined, AxAIRekaChatRequest, unknown, AxAIRekaChatResponse, AxAIRekaChatResponseDelta, unknown> {
|
|
2419
|
-
constructor({ apiKey, config, options, apiURL, modelInfo, models, }: Readonly<Omit<AxAIRekaArgs
|
|
2418
|
+
declare class AxAIReka<TModelKey = string> extends AxBaseAI<AxAIRekaModel, undefined, AxAIRekaChatRequest, unknown, AxAIRekaChatResponse, AxAIRekaChatResponseDelta, unknown, TModelKey> {
|
|
2419
|
+
constructor({ apiKey, config, options, apiURL, modelInfo, models, }: Readonly<Omit<AxAIRekaArgs<TModelKey>, 'name'>>);
|
|
2420
2420
|
}
|
|
2421
2421
|
|
|
2422
2422
|
/**
|
|
@@ -2426,9 +2426,9 @@ declare const axModelInfoReka: AxModelInfo[];
|
|
|
2426
2426
|
|
|
2427
2427
|
type TogetherAIConfig = AxAIOpenAIConfig<string, unknown>;
|
|
2428
2428
|
declare const axAITogetherDefaultConfig: () => TogetherAIConfig;
|
|
2429
|
-
type AxAITogetherArgs = AxAIOpenAIArgs<'together', string, unknown>;
|
|
2430
|
-
declare class AxAITogether extends AxAIOpenAIBase<string, unknown> {
|
|
2431
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAITogetherArgs
|
|
2429
|
+
type AxAITogetherArgs<TModelKey> = AxAIOpenAIArgs<'together', string, unknown, TModelKey>;
|
|
2430
|
+
declare class AxAITogether<TModelKey = string> extends AxAIOpenAIBase<string, unknown, TModelKey> {
|
|
2431
|
+
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAITogetherArgs<TModelKey>, 'name'>>);
|
|
2432
2432
|
}
|
|
2433
2433
|
|
|
2434
2434
|
declare const axModelInfoTogether: AxModelInfo[];
|
|
@@ -2447,30 +2447,6 @@ declare function axValidateChatRequestMessage(item: AxChatRequestMessage): void;
|
|
|
2447
2447
|
*/
|
|
2448
2448
|
declare function axValidateChatResponseResult(results: Readonly<AxChatResponseResult[]> | Readonly<AxChatResponseResult>): void;
|
|
2449
2449
|
|
|
2450
|
-
type AxAIArgs = AxAIOpenAIArgs | AxAIOpenAIResponsesArgs | AxAIAzureOpenAIArgs | AxAITogetherArgs | AxAIAnthropicArgs | AxAIGroqArgs | AxAIGoogleGeminiArgs | AxAICohereArgs | AxAIHuggingFaceArgs | AxAIMistralArgs | AxAIDeepSeekArgs | AxAIOllamaArgs | AxAIRekaArgs;
|
|
2451
|
-
type AxAIModels = AxAIOpenAIModel | AxAIAnthropicModel | AxAIGroqModel | AxAIGoogleGeminiModel | AxAICohereModel | AxAIHuggingFaceModel | AxAIMistralModel | AxAIDeepSeekModel;
|
|
2452
|
-
type AxAIEmbedModels = AxAIOpenAIEmbedModel | AxAIGoogleGeminiEmbedModel | AxAICohereEmbedModel;
|
|
2453
|
-
declare class AxAI implements AxAIService {
|
|
2454
|
-
private ai;
|
|
2455
|
-
constructor(options: Readonly<AxAIArgs>);
|
|
2456
|
-
getName(): string;
|
|
2457
|
-
getId(): string;
|
|
2458
|
-
getFeatures(model?: string): {
|
|
2459
|
-
functions: boolean;
|
|
2460
|
-
streaming: boolean;
|
|
2461
|
-
};
|
|
2462
|
-
getModelList(): AxAIModelList | undefined;
|
|
2463
|
-
getLastUsedChatModel(): unknown;
|
|
2464
|
-
getLastUsedEmbedModel(): unknown;
|
|
2465
|
-
getLastUsedModelConfig(): AxModelConfig | undefined;
|
|
2466
|
-
getMetrics(): AxAIServiceMetrics;
|
|
2467
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
2468
|
-
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
2469
|
-
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
2470
|
-
getOptions(): Readonly<AxAIServiceOptions>;
|
|
2471
|
-
getLogger(): AxLoggerFunction;
|
|
2472
|
-
}
|
|
2473
|
-
|
|
2474
2450
|
declare enum AxAIGrokModel {
|
|
2475
2451
|
Grok3 = "grok-3",
|
|
2476
2452
|
Grok3Mini = "grok-3-mini",
|
|
@@ -2512,14 +2488,38 @@ type AxAIGrokChatRequest = AxAIOpenAIChatRequest<AxAIGrokModel> & {
|
|
|
2512
2488
|
sources?: AxAIGrokSearchSource[];
|
|
2513
2489
|
};
|
|
2514
2490
|
};
|
|
2515
|
-
type AxAIGrokArgs = AxAIOpenAIArgs<'grok', AxAIGrokModel, AxAIGrokEmbedModels, AxAIGrokChatRequest> & {
|
|
2491
|
+
type AxAIGrokArgs<TModelKey = string> = AxAIOpenAIArgs<'grok', AxAIGrokModel, AxAIGrokEmbedModels, TModelKey, AxAIGrokChatRequest> & {
|
|
2516
2492
|
options?: Readonly<AxAIServiceOptions & AxAIGrokOptionsTools> & {
|
|
2517
2493
|
tokensPerMinute?: number;
|
|
2518
2494
|
};
|
|
2519
2495
|
modelInfo?: AxModelInfo[];
|
|
2520
2496
|
};
|
|
2521
|
-
declare class AxAIGrok extends AxAIOpenAIBase<AxAIGrokModel, AxAIGrokEmbedModels, AxAIGrokChatRequest> {
|
|
2522
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIGrokArgs
|
|
2497
|
+
declare class AxAIGrok<TModelKey = string> extends AxAIOpenAIBase<AxAIGrokModel, AxAIGrokEmbedModels, TModelKey, AxAIGrokChatRequest> {
|
|
2498
|
+
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIGrokArgs<TModelKey>, 'name'>>);
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
type AxAIArgs<TModelKey> = AxAIOpenAIArgs<'openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey> | AxAIOpenAIResponsesArgs<'openai-responses', AxAIOpenAIResponsesModel, AxAIOpenAIEmbedModel, TModelKey> | AxAIAzureOpenAIArgs<TModelKey> | AxAITogetherArgs<TModelKey> | AxAIAnthropicArgs<TModelKey> | AxAIGroqArgs<TModelKey> | AxAIGoogleGeminiArgs<TModelKey> | AxAICohereArgs<TModelKey> | AxAIHuggingFaceArgs<TModelKey> | AxAIMistralArgs<TModelKey> | AxAIDeepSeekArgs<TModelKey> | AxAIOllamaArgs<TModelKey> | AxAIRekaArgs<TModelKey> | AxAIGrokArgs<TModelKey>;
|
|
2502
|
+
type AxAIModels = AxAIOpenAIModel | AxAIAnthropicModel | AxAIGroqModel | AxAIGoogleGeminiModel | AxAICohereModel | AxAIHuggingFaceModel | AxAIMistralModel | AxAIDeepSeekModel | AxAIGrokModel;
|
|
2503
|
+
type AxAIEmbedModels = AxAIOpenAIEmbedModel | AxAIGoogleGeminiEmbedModel | AxAICohereEmbedModel;
|
|
2504
|
+
declare class AxAI<TModelKey = string> implements AxAIService<unknown, unknown, TModelKey> {
|
|
2505
|
+
private ai;
|
|
2506
|
+
constructor(options: Readonly<AxAIArgs<TModelKey>>);
|
|
2507
|
+
getName(): string;
|
|
2508
|
+
getId(): string;
|
|
2509
|
+
getFeatures(model?: string): {
|
|
2510
|
+
functions: boolean;
|
|
2511
|
+
streaming: boolean;
|
|
2512
|
+
};
|
|
2513
|
+
getModelList(): AxAIModelList<TModelKey> | undefined;
|
|
2514
|
+
getLastUsedChatModel(): unknown;
|
|
2515
|
+
getLastUsedEmbedModel(): unknown;
|
|
2516
|
+
getLastUsedModelConfig(): AxModelConfig | undefined;
|
|
2517
|
+
getMetrics(): AxAIServiceMetrics;
|
|
2518
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown, TModelKey>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
2519
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions<unknown, unknown, TModelKey>>): Promise<AxEmbedResponse>;
|
|
2520
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
2521
|
+
getOptions(): Readonly<AxAIServiceOptions>;
|
|
2522
|
+
getLogger(): AxLoggerFunction;
|
|
2523
2523
|
}
|
|
2524
2524
|
|
|
2525
2525
|
declare const axModelInfoGrok: AxModelInfo[];
|
|
@@ -2945,13 +2945,13 @@ type AxResultPickerFunctionFunctionResults = {
|
|
|
2945
2945
|
}[];
|
|
2946
2946
|
};
|
|
2947
2947
|
type AxResultPickerFunction<OUT extends AxGenOut> = (data: AxResultPickerFunctionFieldResults<OUT> | AxResultPickerFunctionFunctionResults) => number | Promise<number>;
|
|
2948
|
-
type AxProgramForwardOptions = {
|
|
2948
|
+
type AxProgramForwardOptions<MODEL> = {
|
|
2949
2949
|
maxRetries?: number;
|
|
2950
2950
|
maxSteps?: number;
|
|
2951
2951
|
mem?: AxAIMemory;
|
|
2952
2952
|
ai?: AxAIService;
|
|
2953
2953
|
modelConfig?: AxModelConfig;
|
|
2954
|
-
model?:
|
|
2954
|
+
model?: MODEL;
|
|
2955
2955
|
sessionId?: string;
|
|
2956
2956
|
traceId?: string | undefined;
|
|
2957
2957
|
tracer?: Tracer;
|
|
@@ -2978,7 +2978,7 @@ type AxProgramForwardOptions = {
|
|
|
2978
2978
|
excludeContentFromTrace?: boolean;
|
|
2979
2979
|
strictMode?: boolean;
|
|
2980
2980
|
};
|
|
2981
|
-
type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions
|
|
2981
|
+
type AxProgramStreamingForwardOptions<MODEL> = Omit<AxProgramForwardOptions<MODEL>, 'stream'>;
|
|
2982
2982
|
type AxGenDeltaOut<OUT extends AxGenOut> = {
|
|
2983
2983
|
version: number;
|
|
2984
2984
|
index: number;
|
|
@@ -2986,9 +2986,9 @@ type AxGenDeltaOut<OUT extends AxGenOut> = {
|
|
|
2986
2986
|
};
|
|
2987
2987
|
type AxGenStreamingOut<OUT extends AxGenOut> = AsyncGenerator<AxGenDeltaOut<OUT>, void, unknown>;
|
|
2988
2988
|
type AxSetExamplesOptions = {};
|
|
2989
|
-
interface AxForwardable<IN extends AxGenIn, OUT extends AxGenOut> {
|
|
2990
|
-
forward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramForwardOptions
|
|
2991
|
-
streamingForward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramStreamingForwardOptions
|
|
2989
|
+
interface AxForwardable<IN extends AxGenIn, OUT extends AxGenOut, TModelKey> {
|
|
2990
|
+
forward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramForwardOptions<TModelKey>>): Promise<OUT>;
|
|
2991
|
+
streamingForward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramStreamingForwardOptions<TModelKey>>): AxGenStreamingOut<OUT>;
|
|
2992
2992
|
}
|
|
2993
2993
|
interface AxTunable<IN extends AxGenIn, OUT extends AxGenOut> {
|
|
2994
2994
|
setExamples: (examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>) => void;
|
|
@@ -3001,7 +3001,7 @@ interface AxUsable {
|
|
|
3001
3001
|
getUsage: () => AxProgramUsage[];
|
|
3002
3002
|
resetUsage: () => void;
|
|
3003
3003
|
}
|
|
3004
|
-
interface AxProgrammable<IN extends AxGenIn, OUT extends AxGenOut> extends AxForwardable<IN, OUT>, AxTunable<IN, OUT>, AxUsable {
|
|
3004
|
+
interface AxProgrammable<IN extends AxGenIn, OUT extends AxGenOut, TModelKey = string> extends AxForwardable<IN, OUT, TModelKey>, AxTunable<IN, OUT>, AxUsable {
|
|
3005
3005
|
getSignature: () => AxSignature;
|
|
3006
3006
|
}
|
|
3007
3007
|
type AxProgramUsage = AxChatResponse['modelUsage'] & {
|
|
@@ -3115,7 +3115,7 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOu
|
|
|
3115
3115
|
private streamingFieldProcessors;
|
|
3116
3116
|
private excludeContentFromTrace;
|
|
3117
3117
|
private thoughtFieldName;
|
|
3118
|
-
constructor(signature: NonNullable<ConstructorParameters<typeof AxSignature>[0]>, options?: Readonly<AxProgramForwardOptions
|
|
3118
|
+
constructor(signature: NonNullable<ConstructorParameters<typeof AxSignature>[0]>, options?: Readonly<AxProgramForwardOptions<any>>);
|
|
3119
3119
|
private getSignatureName;
|
|
3120
3120
|
private getMetricsInstruments;
|
|
3121
3121
|
updateMeter(meter?: Meter): void;
|
|
@@ -3128,9 +3128,9 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOu
|
|
|
3128
3128
|
private forwardSendRequest;
|
|
3129
3129
|
private forwardCore;
|
|
3130
3130
|
private _forward2;
|
|
3131
|
-
_forward1(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options: Readonly<AxProgramForwardOptions
|
|
3132
|
-
forward
|
|
3133
|
-
streamingForward
|
|
3131
|
+
_forward1(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options: Readonly<AxProgramForwardOptions<any>>): AxGenStreamingOut<OUT>;
|
|
3132
|
+
forward<T extends Readonly<AxAIService>>(ai: T, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']>>): Promise<OUT>;
|
|
3133
|
+
streamingForward<T extends Readonly<AxAIService>>(ai: T, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramStreamingForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']>>): AxGenStreamingOut<OUT>;
|
|
3134
3134
|
setExamples(examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>): void;
|
|
3135
3135
|
private isDebug;
|
|
3136
3136
|
private getLogger;
|
|
@@ -3201,8 +3201,8 @@ declare class AxDBManager {
|
|
|
3201
3201
|
}
|
|
3202
3202
|
|
|
3203
3203
|
declare class AxDefaultResultReranker extends AxGen<AxRerankerIn, AxRerankerOut> {
|
|
3204
|
-
constructor(options?: Readonly<AxProgramForwardOptions
|
|
3205
|
-
forward:
|
|
3204
|
+
constructor(options?: Readonly<AxProgramForwardOptions<string>>);
|
|
3205
|
+
forward: <T extends Readonly<AxAIService>>(ai: T, input: Readonly<AxRerankerIn>, options?: Readonly<AxProgramForwardOptions<NonNullable<ReturnType<T["getModelList"]>>[number]["key"]>>) => Promise<AxRerankerOut>;
|
|
3206
3206
|
}
|
|
3207
3207
|
|
|
3208
3208
|
interface AxApacheTikaArgs {
|
|
@@ -4293,11 +4293,11 @@ interface AxFlowNodeDefinition {
|
|
|
4293
4293
|
}
|
|
4294
4294
|
type AxFlowStepFunction = (state: AxFlowState, context: Readonly<{
|
|
4295
4295
|
mainAi: AxAIService;
|
|
4296
|
-
mainOptions?: AxProgramForwardOptions
|
|
4296
|
+
mainOptions?: AxProgramForwardOptions<string>;
|
|
4297
4297
|
}>) => Promise<AxFlowState> | AxFlowState;
|
|
4298
|
-
interface AxFlowDynamicContext {
|
|
4299
|
-
ai?:
|
|
4300
|
-
options?: AxProgramForwardOptions
|
|
4298
|
+
interface AxFlowDynamicContext<T extends Readonly<AxAIService>> {
|
|
4299
|
+
ai?: T;
|
|
4300
|
+
options?: AxProgramForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']>;
|
|
4301
4301
|
}
|
|
4302
4302
|
type GetGenIn<T extends AxProgrammable<AxGenIn, AxGenOut>> = T extends AxProgrammable<infer IN, AxGenOut> ? IN : never;
|
|
4303
4303
|
type GetGenOut<T extends AxProgrammable<AxGenIn, AxGenOut>> = T extends AxProgrammable<AxGenIn, infer OUT> ? OUT : never;
|
|
@@ -4314,20 +4314,20 @@ interface AxFlowable<IN extends AxGenIn, OUT extends AxGenOut> extends AxProgram
|
|
|
4314
4314
|
}
|
|
4315
4315
|
type AxFlowTypedParallelBranch<TNodes extends Record<string, AxProgrammable<any, any>>, TState extends AxFlowState> = (subFlow: AxFlowTypedSubContext<TNodes, TState>) => AxFlowTypedSubContext<TNodes, AxFlowState>;
|
|
4316
4316
|
interface AxFlowTypedSubContext<TNodes extends Record<string, AxProgrammable<any, any>>, TState extends AxFlowState> {
|
|
4317
|
-
execute<TNodeName extends keyof TNodes & string
|
|
4317
|
+
execute<TNodeName extends keyof TNodes & string, TAI extends Readonly<AxAIService>>(nodeName: TNodeName, mapping: (state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext<TAI>): AxFlowTypedSubContext<TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
|
|
4318
4318
|
map<TNewState extends AxFlowState>(transform: (state: TState) => TNewState): AxFlowTypedSubContext<TNodes, TNewState>;
|
|
4319
4319
|
executeSteps(initialState: TState, context: Readonly<{
|
|
4320
4320
|
mainAi: AxAIService;
|
|
4321
|
-
mainOptions?: AxProgramForwardOptions
|
|
4321
|
+
mainOptions?: AxProgramForwardOptions<string>;
|
|
4322
4322
|
}>): Promise<AxFlowState>;
|
|
4323
4323
|
}
|
|
4324
4324
|
type AxFlowParallelBranch = (subFlow: AxFlowSubContext) => AxFlowSubContext;
|
|
4325
4325
|
interface AxFlowSubContext {
|
|
4326
|
-
execute(nodeName: string, mapping: (state: AxFlowState) => Record<string, AxFieldValue>, dynamicContext?: AxFlowDynamicContext): this;
|
|
4326
|
+
execute<TAI extends Readonly<AxAIService>>(nodeName: string, mapping: (state: AxFlowState) => Record<string, AxFieldValue>, dynamicContext?: AxFlowDynamicContext<TAI>): this;
|
|
4327
4327
|
map(transform: (state: AxFlowState) => AxFlowState): this;
|
|
4328
|
-
executeSteps(initialState: AxFlowState, context: Readonly<{
|
|
4329
|
-
mainAi:
|
|
4330
|
-
mainOptions?: AxProgramForwardOptions
|
|
4328
|
+
executeSteps<TAI extends Readonly<AxAIService>>(initialState: AxFlowState, context: Readonly<{
|
|
4329
|
+
mainAi: TAI;
|
|
4330
|
+
mainOptions?: AxProgramForwardOptions<NonNullable<ReturnType<TAI['getModelList']>>[number]['key']>;
|
|
4331
4331
|
}>): Promise<AxFlowState>;
|
|
4332
4332
|
}
|
|
4333
4333
|
interface AxFlowBranchContext {
|
|
@@ -4601,6 +4601,8 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4601
4601
|
private readonly autoParallelConfig;
|
|
4602
4602
|
private readonly executionPlanner;
|
|
4603
4603
|
private program?;
|
|
4604
|
+
private nodeUsage;
|
|
4605
|
+
private nodeTraces;
|
|
4604
4606
|
/**
|
|
4605
4607
|
* Converts a string to camelCase for valid field names
|
|
4606
4608
|
*/
|
|
@@ -4640,7 +4642,26 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4640
4642
|
setDemos(demos: readonly AxProgramDemos<IN, OUT>[]): void;
|
|
4641
4643
|
getUsage(): AxProgramUsage[];
|
|
4642
4644
|
resetUsage(): void;
|
|
4643
|
-
|
|
4645
|
+
/**
|
|
4646
|
+
* Resets trace tracking for the flow.
|
|
4647
|
+
* This is called automatically on each forward/streamingForward call.
|
|
4648
|
+
*/
|
|
4649
|
+
resetTraces(): void;
|
|
4650
|
+
/**
|
|
4651
|
+
* Gets a detailed usage report broken down by node name.
|
|
4652
|
+
* This provides visibility into which nodes are consuming the most tokens.
|
|
4653
|
+
*
|
|
4654
|
+
* @returns Object mapping node names to their usage statistics
|
|
4655
|
+
*/
|
|
4656
|
+
getUsageReport(): Record<string, AxProgramUsage[]>;
|
|
4657
|
+
/**
|
|
4658
|
+
* Gets a detailed trace report broken down by node name.
|
|
4659
|
+
* This provides visibility into the execution traces for each node.
|
|
4660
|
+
*
|
|
4661
|
+
* @returns Object mapping node names to their trace data
|
|
4662
|
+
*/
|
|
4663
|
+
getTracesReport(): Record<string, AxProgramTrace<any, any>[]>;
|
|
4664
|
+
streamingForward<T extends Readonly<AxAIService>>(ai: T, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramStreamingForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']>>): AxGenStreamingOut<OUT>;
|
|
4644
4665
|
/**
|
|
4645
4666
|
* Executes the flow with the given AI service and input values.
|
|
4646
4667
|
*
|
|
@@ -4671,7 +4692,7 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4671
4692
|
* @param options - Optional forward options to use as defaults (includes autoParallel override)
|
|
4672
4693
|
* @returns Promise that resolves to the final output
|
|
4673
4694
|
*/
|
|
4674
|
-
forward
|
|
4695
|
+
forward<T extends Readonly<AxAIService>>(ai: T, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']> & {
|
|
4675
4696
|
autoParallel?: boolean;
|
|
4676
4697
|
}>): Promise<OUT>;
|
|
4677
4698
|
/**
|
|
@@ -4680,7 +4701,6 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4680
4701
|
*
|
|
4681
4702
|
* @param name - The name of the node
|
|
4682
4703
|
* @param signature - Signature string in the same format as AxSignature
|
|
4683
|
-
* @param options - Optional program forward options (same as AxGen)
|
|
4684
4704
|
* @returns New AxFlow instance with updated TNodes type
|
|
4685
4705
|
*
|
|
4686
4706
|
* @example
|
|
@@ -4689,7 +4709,7 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4689
4709
|
* flow.node('analyzer', 'text:string -> analysis:string, confidence:number', { debug: true })
|
|
4690
4710
|
* ```
|
|
4691
4711
|
*/
|
|
4692
|
-
node<TName extends string, TSig extends string>(name: TName, signature: TSig
|
|
4712
|
+
node<TName extends string, TSig extends string>(name: TName, signature: TSig): AxFlow<IN, OUT, TNodes & {
|
|
4693
4713
|
[K in TName]: InferAxGen<TSig>;
|
|
4694
4714
|
}, // Add new node to registry
|
|
4695
4715
|
TState>;
|
|
@@ -4699,7 +4719,6 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4699
4719
|
*
|
|
4700
4720
|
* @param name - The name of the node
|
|
4701
4721
|
* @param signature - AxSignature instance to use for this node
|
|
4702
|
-
* @param options - Optional program forward options (same as AxGen)
|
|
4703
4722
|
* @returns New AxFlow instance with updated TNodes type
|
|
4704
4723
|
*
|
|
4705
4724
|
* @example
|
|
@@ -4708,7 +4727,7 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4708
4727
|
* flow.node('summarizer', sig, { temperature: 0.1 })
|
|
4709
4728
|
* ```
|
|
4710
4729
|
*/
|
|
4711
|
-
node<TName extends string>(name: TName, signature: AxSignature
|
|
4730
|
+
node<TName extends string>(name: TName, signature: AxSignature): AxFlow<IN, OUT, TNodes & {
|
|
4712
4731
|
[K in TName]: AxGen<AxGenIn, AxGenOut>;
|
|
4713
4732
|
}, // Add new node to registry
|
|
4714
4733
|
TState>;
|
|
@@ -4747,10 +4766,10 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4747
4766
|
/**
|
|
4748
4767
|
* Short alias for node() - supports signature strings, AxSignature instances, AxGen instances, and program classes
|
|
4749
4768
|
*/
|
|
4750
|
-
n<TName extends string, TSig extends string>(name: TName, signature: TSig
|
|
4769
|
+
n<TName extends string, TSig extends string>(name: TName, signature: TSig): AxFlow<IN, OUT, TNodes & {
|
|
4751
4770
|
[K in TName]: InferAxGen<TSig>;
|
|
4752
4771
|
}, TState>;
|
|
4753
|
-
n<TName extends string>(name: TName, signature: AxSignature
|
|
4772
|
+
n<TName extends string>(name: TName, signature: AxSignature): AxFlow<IN, OUT, TNodes & {
|
|
4754
4773
|
[K in TName]: AxGen<AxGenIn, AxGenOut>;
|
|
4755
4774
|
}, TState>;
|
|
4756
4775
|
n<TName extends string, TProgram extends new () => AxProgrammable<any, any>>(name: TName, programClass: TProgram): AxFlow<IN, OUT, TNodes & {
|
|
@@ -4835,11 +4854,11 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
4835
4854
|
* flow.execute('summarizer', state => ({ text: state.originalText }), { ai: cheapAI })
|
|
4836
4855
|
* ```
|
|
4837
4856
|
*/
|
|
4838
|
-
execute<TNodeName extends keyof TNodes & string
|
|
4857
|
+
execute<TNodeName extends keyof TNodes & string, TAI extends Readonly<AxAIService>>(nodeName: TNodeName, mapping: (_state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext<TAI>): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
|
|
4839
4858
|
/**
|
|
4840
4859
|
* Short alias for execute()
|
|
4841
4860
|
*/
|
|
4842
|
-
e<TNodeName extends keyof TNodes & string
|
|
4861
|
+
e<TNodeName extends keyof TNodes & string, TAI extends Readonly<AxAIService>>(nodeName: TNodeName, mapping: (_state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext<TAI>): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
|
|
4843
4862
|
/**
|
|
4844
4863
|
* Starts a conditional branch based on a predicate function.
|
|
4845
4864
|
*
|
|
@@ -5050,12 +5069,12 @@ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
|
|
|
5050
5069
|
declare class AxFlowSubContextImpl implements AxFlowSubContext {
|
|
5051
5070
|
private readonly nodeGenerators;
|
|
5052
5071
|
private readonly steps;
|
|
5053
|
-
constructor(nodeGenerators: Map<string, AxForwardable<AxGenIn, AxGenOut> & AxTunable<AxGenIn, AxGenOut> & AxUsable>);
|
|
5054
|
-
execute(nodeName: string, mapping: (state: AxFlowState) => Record<string, AxFieldValue>, dynamicContext?: AxFlowDynamicContext): this;
|
|
5072
|
+
constructor(nodeGenerators: Map<string, AxForwardable<AxGenIn, AxGenOut, string> & AxTunable<AxGenIn, AxGenOut> & AxUsable>);
|
|
5073
|
+
execute<TAI extends Readonly<AxAIService>>(nodeName: string, mapping: (state: AxFlowState) => Record<string, AxFieldValue>, dynamicContext?: AxFlowDynamicContext<TAI>): this;
|
|
5055
5074
|
map(transform: (state: AxFlowState) => AxFlowState): this;
|
|
5056
5075
|
executeSteps(initialState: AxFlowState, context: Readonly<{
|
|
5057
5076
|
mainAi: AxAIService;
|
|
5058
|
-
mainOptions?: AxProgramForwardOptions
|
|
5077
|
+
mainOptions?: AxProgramForwardOptions<string>;
|
|
5059
5078
|
}>): Promise<AxFlowState>;
|
|
5060
5079
|
}
|
|
5061
5080
|
/**
|
|
@@ -5065,11 +5084,11 @@ declare class AxFlowTypedSubContextImpl<TNodes extends Record<string, AxGen<any,
|
|
|
5065
5084
|
private readonly nodeGenerators;
|
|
5066
5085
|
private readonly steps;
|
|
5067
5086
|
constructor(nodeGenerators: Map<string, AxGen<AxGenIn, AxGenOut> | AxProgram<AxGenIn, AxGenOut>>);
|
|
5068
|
-
execute<TNodeName extends keyof TNodes & string
|
|
5087
|
+
execute<TNodeName extends keyof TNodes & string, TAI extends Readonly<AxAIService>>(nodeName: TNodeName, mapping: (state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext<TAI>): AxFlowTypedSubContext<TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
|
|
5069
5088
|
map<TNewState extends AxFlowState>(transform: (state: TState) => TNewState): AxFlowTypedSubContext<TNodes, TNewState>;
|
|
5070
5089
|
executeSteps(initialState: TState, context: Readonly<{
|
|
5071
5090
|
mainAi: AxAIService;
|
|
5072
|
-
mainOptions?: AxProgramForwardOptions
|
|
5091
|
+
mainOptions?: AxProgramForwardOptions<string>;
|
|
5073
5092
|
}>): Promise<AxFlowState>;
|
|
5074
5093
|
}
|
|
5075
5094
|
|
|
@@ -5409,7 +5428,7 @@ interface AxAgentic<IN extends AxGenIn, OUT extends AxGenOut> extends AxProgramm
|
|
|
5409
5428
|
getFunction(): AxFunction;
|
|
5410
5429
|
getFeatures(): AxAgentFeatures;
|
|
5411
5430
|
}
|
|
5412
|
-
type AxAgentOptions = Omit<AxProgramForwardOptions
|
|
5431
|
+
type AxAgentOptions = Omit<AxProgramForwardOptions<string>, 'functions'> & {
|
|
5413
5432
|
disableSmartModelRouting?: boolean;
|
|
5414
5433
|
/** List of field names that should not be automatically passed from parent to child agents */
|
|
5415
5434
|
excludeFieldsFromPassthrough?: string[];
|
|
@@ -5460,8 +5479,8 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
|
|
|
5460
5479
|
* Initializes the agent's execution context, processing child agents and their functions.
|
|
5461
5480
|
*/
|
|
5462
5481
|
private init;
|
|
5463
|
-
forward
|
|
5464
|
-
streamingForward
|
|
5482
|
+
forward<T extends Readonly<AxAIService>>(parentAi: T, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']>>): Promise<OUT>;
|
|
5483
|
+
streamingForward<T extends Readonly<AxAIService>>(parentAi: T, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramStreamingForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']>>): AxGenStreamingOut<OUT>;
|
|
5465
5484
|
/**
|
|
5466
5485
|
* Updates the agent's description.
|
|
5467
5486
|
* This updates both the stored description and the function's description.
|
|
@@ -5477,7 +5496,7 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
|
|
|
5477
5496
|
}
|
|
5478
5497
|
|
|
5479
5498
|
declare class AxChainOfThought<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> extends AxGen<IN, OUT> {
|
|
5480
|
-
constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxProgramForwardOptions & {
|
|
5499
|
+
constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxProgramForwardOptions<string> & {
|
|
5481
5500
|
setVisibleReasoning?: boolean;
|
|
5482
5501
|
}>);
|
|
5483
5502
|
}
|
|
@@ -5491,16 +5510,16 @@ declare class AxRAG extends AxChainOfThought<{
|
|
|
5491
5510
|
private genQuery;
|
|
5492
5511
|
private queryFn;
|
|
5493
5512
|
private maxHops;
|
|
5494
|
-
constructor(queryFn: (query: string) => Promise<string>, options: Readonly<AxProgramForwardOptions & {
|
|
5513
|
+
constructor(queryFn: (query: string) => Promise<string>, options: Readonly<AxProgramForwardOptions<string> & {
|
|
5495
5514
|
maxHops?: number;
|
|
5496
5515
|
}>);
|
|
5497
|
-
forward
|
|
5516
|
+
forward<T extends Readonly<AxAIService>>(ai: T, values: {
|
|
5498
5517
|
context: string[];
|
|
5499
5518
|
question: string;
|
|
5500
5519
|
} | AxMessage<{
|
|
5501
5520
|
context: string[];
|
|
5502
5521
|
question: string;
|
|
5503
|
-
}>[], options?: Readonly<AxProgramForwardOptions
|
|
5522
|
+
}>[], options?: Readonly<AxProgramForwardOptions<NonNullable<ReturnType<T['getModelList']>>[number]['key']>>): Promise<{
|
|
5504
5523
|
answer: string;
|
|
5505
5524
|
}>;
|
|
5506
5525
|
}
|