@ax-llm/ax 13.0.5 → 13.0.7

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.d.cts CHANGED
@@ -285,10 +285,64 @@ type AxInternalEmbedRequest<TEmbedModel> = Omit<AxEmbedRequest, 'embedModel'> &
285
285
  type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream<T>>, info: Readonly<{
286
286
  modelUsage?: AxModelUsage;
287
287
  }>) => Promise<T | ReadableStream<T>>;
288
- type AxLoggerTag = 'error' | 'warning' | 'functionName' | 'functionArg' | 'functionResult' | 'functionError' | 'firstFunction' | 'multipleFunctions' | 'responseContent' | 'responseDelta' | 'responseEnd' | 'requestStart' | 'requestContent' | 'systemContent' | 'userStart' | 'userContent' | 'assistantStart' | 'assistantContent' | 'assistantEnd' | 'discovery' | 'optimizer' | 'start' | 'end' | 'config' | 'phase' | 'progress' | 'result' | 'complete' | 'checkpoint';
289
- type AxLoggerFunction = (message: string, options?: {
290
- tags?: AxLoggerTag[];
291
- }) => void;
288
+ type AxLoggerData = {
289
+ name: 'ChatRequestChatPrompt';
290
+ step: number;
291
+ value: AxChatRequest['chatPrompt'];
292
+ } | {
293
+ name: 'FunctionResults';
294
+ value: AxFunctionResult[];
295
+ } | {
296
+ name: 'ChatResponseResults';
297
+ value: AxChatResponseResult[];
298
+ } | {
299
+ name: 'ChatResponseStreamingResult';
300
+ index: number;
301
+ value: AxChatResponseResult & {
302
+ delta?: string;
303
+ };
304
+ } | {
305
+ name: 'FunctionError';
306
+ index: number;
307
+ fixingInstructions: string;
308
+ error: unknown;
309
+ } | {
310
+ name: 'ValidationError';
311
+ index: number;
312
+ fixingInstructions: string;
313
+ error: unknown;
314
+ } | {
315
+ name: 'AssertionError';
316
+ index: number;
317
+ fixingInstructions: string;
318
+ error: unknown;
319
+ } | {
320
+ name: 'RefusalError';
321
+ index: number;
322
+ error: unknown;
323
+ } | {
324
+ name: 'ResultPickerUsed';
325
+ sampleCount: number;
326
+ selectedIndex: number;
327
+ latency: number;
328
+ } | {
329
+ name: 'Notification';
330
+ id: string;
331
+ value: string;
332
+ } | {
333
+ name: 'EmbedRequest';
334
+ embedModel: string;
335
+ value: readonly string[];
336
+ } | {
337
+ name: 'EmbedResponse';
338
+ totalEmbeddings: number;
339
+ value: {
340
+ length: number;
341
+ sample: number[];
342
+ truncated: boolean;
343
+ }[];
344
+ };
345
+ type AxLoggerFunction = (message: AxLoggerData) => void;
292
346
  type AxAIPromptConfig = {
293
347
  stream?: boolean;
294
348
  thinkingTokenBudget?: 'minimal' | 'low' | 'medium' | 'high' | 'highest' | 'none';
@@ -309,7 +363,7 @@ type AxAIServiceOptions = {
309
363
  type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
310
364
  ai?: Readonly<AxAIService<TModel, TEmbedModel>>;
311
365
  sessionId?: string;
312
- traceId?: string;
366
+ traceId?: string | undefined;
313
367
  timeout?: number;
314
368
  rateLimiter?: AxRateLimiterFunction;
315
369
  debug?: boolean;
@@ -317,6 +371,7 @@ type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
317
371
  traceContext?: Context;
318
372
  abortSignal?: AbortSignal;
319
373
  logger?: AxLoggerFunction;
374
+ stepIndex?: number;
320
375
  functionResultFormatter?: (result: unknown) => string;
321
376
  };
322
377
  interface AxAIService<TModel = unknown, TEmbedModel = unknown> {
@@ -2686,62 +2741,10 @@ declare class AxSignature {
2686
2741
  };
2687
2742
  }
2688
2743
 
2689
- type AxFieldValue = string | string[] | number | boolean | object | null | undefined | {
2690
- mimeType: string;
2691
- data: string;
2692
- } | {
2693
- mimeType: string;
2694
- data: string;
2695
- }[] | {
2696
- format?: 'wav';
2697
- data: string;
2698
- } | {
2699
- format?: 'wav';
2700
- data: string;
2701
- }[];
2702
- type AxGenIn = {
2703
- [key: string]: AxFieldValue;
2704
- };
2705
- type AxGenOut = {
2706
- [key: string]: AxFieldValue;
2707
- };
2708
- type AxMessage<IN extends AxGenIn> = {
2709
- role: 'user';
2710
- values: IN;
2711
- } | {
2712
- role: 'assistant';
2713
- values: IN;
2714
- };
2715
-
2716
- interface AxAssertion {
2717
- fn(values: Record<string, unknown>): Promise<boolean | undefined> | boolean | undefined;
2718
- message?: string;
2719
- }
2720
- interface AxStreamingAssertion {
2721
- fieldName: string;
2722
- fn(content: string, done?: boolean): boolean | undefined;
2723
- message?: string;
2724
- }
2725
- declare class AxAssertionError extends Error {
2726
- constructor({ message, }: Readonly<{
2727
- message: string;
2728
- }>);
2729
- getFixingInstructions: () => {
2730
- name: string;
2731
- title: string;
2732
- description: string;
2733
- }[];
2734
- toString(): string;
2735
- }
2736
-
2737
2744
  declare class AxMemory implements AxAIMemory {
2738
- private options?;
2739
2745
  private memories;
2740
2746
  private defaultMemory;
2741
- constructor(options?: {
2742
- debug?: boolean;
2743
- debugHideSystemPrompt?: boolean;
2744
- } | undefined);
2747
+ constructor();
2745
2748
  private getMemory;
2746
2749
  addRequest(value: AxChatRequest['chatPrompt'], sessionId?: string): void;
2747
2750
  addResponse(results: Readonly<AxChatResponseResult[]>, sessionId?: string): void;
@@ -2884,6 +2887,32 @@ declare class AxPromptTemplate {
2884
2887
  private defaultRenderInField;
2885
2888
  }
2886
2889
 
2890
+ type AxFieldValue = string | string[] | number | boolean | object | null | undefined | {
2891
+ mimeType: string;
2892
+ data: string;
2893
+ } | {
2894
+ mimeType: string;
2895
+ data: string;
2896
+ }[] | {
2897
+ format?: 'wav';
2898
+ data: string;
2899
+ } | {
2900
+ format?: 'wav';
2901
+ data: string;
2902
+ }[];
2903
+ type AxGenIn = {
2904
+ [key: string]: AxFieldValue;
2905
+ };
2906
+ type AxGenOut = {
2907
+ [key: string]: AxFieldValue;
2908
+ };
2909
+ type AxMessage<IN extends AxGenIn> = {
2910
+ role: 'user';
2911
+ values: IN;
2912
+ } | {
2913
+ role: 'assistant';
2914
+ values: IN;
2915
+ };
2887
2916
  type AxProgramTrace<IN extends AxGenIn, OUT extends AxGenOut> = {
2888
2917
  trace: OUT & IN;
2889
2918
  programId: string;
@@ -2932,7 +2961,6 @@ type AxProgramForwardOptions = {
2932
2961
  functionResultFormatter?: (result: unknown) => string;
2933
2962
  fastFail?: boolean;
2934
2963
  debug?: boolean;
2935
- debugHideSystemPrompt?: boolean;
2936
2964
  thinkingTokenBudget?: 'minimal' | 'low' | 'medium' | 'high' | 'highest' | 'none';
2937
2965
  showThoughts?: boolean;
2938
2966
  traceLabel?: string;
@@ -2954,6 +2982,10 @@ type AxGenDeltaOut<OUT extends AxGenOut> = {
2954
2982
  };
2955
2983
  type AxGenStreamingOut<OUT extends AxGenOut> = AsyncGenerator<AxGenDeltaOut<OUT>, void, unknown>;
2956
2984
  type AxSetExamplesOptions = {};
2985
+ interface AxForwardable<IN extends AxGenIn, OUT extends AxGenOut> {
2986
+ forward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
2987
+ streamingForward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
2988
+ }
2957
2989
  interface AxTunable<IN extends AxGenIn, OUT extends AxGenOut> {
2958
2990
  setExamples: (examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>) => void;
2959
2991
  setId: (id: string) => void;
@@ -2965,6 +2997,9 @@ interface AxUsable {
2965
2997
  getUsage: () => AxProgramUsage[];
2966
2998
  resetUsage: () => void;
2967
2999
  }
3000
+ interface AxProgrammable<IN extends AxGenIn, OUT extends AxGenOut> extends AxForwardable<IN, OUT>, AxTunable<IN, OUT>, AxUsable {
3001
+ getSignature: () => AxSignature;
3002
+ }
2968
3003
  type AxProgramUsage = AxChatResponse['modelUsage'] & {
2969
3004
  ai: string;
2970
3005
  model: string;
@@ -2973,77 +3008,26 @@ interface AxProgramOptions {
2973
3008
  description?: string;
2974
3009
  traceLabel?: string;
2975
3010
  }
2976
- declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxTunable<IN, OUT>, AxUsable {
2977
- protected signature: AxSignature;
2978
- protected sigHash: string;
2979
- protected examples?: OUT[];
2980
- protected examplesOptions?: AxSetExamplesOptions;
2981
- protected demos?: OUT[];
2982
- protected trace?: OUT;
2983
- protected usage: AxProgramUsage[];
2984
- protected traceLabel?: string;
2985
- private key;
2986
- private children;
2987
- constructor(signature: NonNullable<ConstructorParameters<typeof AxSignature>[0]>, options?: Readonly<AxProgramOptions>);
2988
- getSignature(): AxSignature;
2989
- register(prog: Readonly<AxTunable<IN, OUT> & AxUsable>): void;
2990
- forward(_ai: Readonly<AxAIService>, _values: IN | AxMessage<IN>[], _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
2991
- streamingForward(_ai: Readonly<AxAIService>, _values: IN | AxMessage<IN>[], _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
2992
- setId(id: string): void;
2993
- setParentId(parentId: string): void;
2994
- setExamples(examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>): void;
2995
- private _setExamples;
2996
- getTraces(): AxProgramTrace<IN, OUT>[];
2997
- getUsage(): AxProgramUsage[];
2998
- resetUsage(): void;
2999
- setDemos(demos: readonly AxProgramDemos<IN, OUT>[]): void;
3000
- }
3001
3011
 
3002
- type AxRewriteIn = {
3003
- query: string;
3004
- };
3005
- type AxRewriteOut = {
3006
- rewrittenQuery: string;
3007
- };
3008
- type AxRerankerIn = {
3009
- query: string;
3010
- items: string[];
3011
- };
3012
- type AxRerankerOut = {
3013
- rankedItems: string[];
3014
- };
3015
- interface AxDBLoaderOptions {
3016
- chunker?: (text: string) => string[];
3017
- rewriter?: AxProgram<AxRewriteIn, AxRewriteOut>;
3018
- reranker?: AxProgram<AxRerankerIn, AxRerankerOut>;
3019
- }
3020
- interface AxDBManagerArgs {
3021
- ai: AxAIService;
3022
- db: AxDBService;
3023
- config?: AxDBLoaderOptions;
3012
+ interface AxAssertion {
3013
+ fn(values: Record<string, unknown>): Promise<boolean | undefined> | boolean | undefined;
3014
+ message?: string;
3024
3015
  }
3025
- interface AxDBMatch {
3026
- score: number;
3027
- text: string;
3016
+ interface AxStreamingAssertion {
3017
+ fieldName: string;
3018
+ fn(content: string, done?: boolean): boolean | undefined;
3019
+ message?: string;
3028
3020
  }
3029
- declare class AxDBManager {
3030
- private ai;
3031
- private db;
3032
- private chunker;
3033
- private rewriter?;
3034
- private reranker?;
3035
- constructor({ ai, db, config }: Readonly<AxDBManagerArgs>);
3036
- private defaultChunker;
3037
- insert: (text: Readonly<string | string[]>, options?: Readonly<{
3038
- batchSize?: number;
3039
- maxWordsPerChunk?: number;
3040
- minWordsPerChunk?: number;
3041
- abortSignal?: AbortSignal;
3042
- }>) => Promise<void>;
3043
- query: (query: Readonly<string | string[] | number | number[]>, { topPercent, abortSignal, }?: Readonly<{
3044
- topPercent?: number;
3045
- abortSignal?: AbortSignal;
3046
- }> | undefined) => Promise<AxDBMatch[][]>;
3021
+ declare class AxAssertionError extends Error {
3022
+ constructor({ message, }: Readonly<{
3023
+ message: string;
3024
+ }>);
3025
+ getFixingInstructions: () => {
3026
+ name: string;
3027
+ title: string;
3028
+ description: string;
3029
+ }[];
3030
+ toString(): string;
3047
3031
  }
3048
3032
 
3049
3033
  type AxFieldProcessorProcess = (value: AxFieldValue, context?: Readonly<{
@@ -3067,6 +3051,33 @@ interface AxFieldProcessor {
3067
3051
  process: AxFieldProcessorProcess | AxStreamingFieldProcessorProcess;
3068
3052
  }
3069
3053
 
3054
+ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxUsable {
3055
+ protected signature: AxSignature;
3056
+ protected sigHash: string;
3057
+ protected examples?: OUT[];
3058
+ protected examplesOptions?: AxSetExamplesOptions;
3059
+ protected demos?: OUT[];
3060
+ protected trace?: OUT;
3061
+ protected usage: AxProgramUsage[];
3062
+ protected traceLabel?: string;
3063
+ private key;
3064
+ private children;
3065
+ constructor(signature: ConstructorParameters<typeof AxSignature>[0], options?: Readonly<AxProgramOptions>);
3066
+ getSignature(): AxSignature;
3067
+ setSignature(signature: ConstructorParameters<typeof AxSignature>[0]): void;
3068
+ setDescription(description: string): void;
3069
+ private updateSignatureHash;
3070
+ register(prog: Readonly<AxTunable<IN, OUT> & AxUsable>): void;
3071
+ setId(id: string): void;
3072
+ setParentId(parentId: string): void;
3073
+ setExamples(examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>): void;
3074
+ private _setExamples;
3075
+ getTraces(): AxProgramTrace<IN, OUT>[];
3076
+ getUsage(): AxProgramUsage[];
3077
+ resetUsage(): void;
3078
+ setDemos(demos: readonly AxProgramDemos<IN, OUT>[]): void;
3079
+ }
3080
+
3070
3081
  type AxGenerateResult<OUT extends AxGenOut> = OUT & {
3071
3082
  thought?: string;
3072
3083
  };
@@ -3090,7 +3101,7 @@ interface AxStreamingEvent<T> {
3090
3101
  functions?: AxChatResponseFunctionCall[];
3091
3102
  };
3092
3103
  }
3093
- declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> extends AxProgram<IN, OUT> {
3104
+ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> extends AxProgram<IN, OUT> implements AxProgrammable<IN, OUT> {
3094
3105
  private promptTemplate;
3095
3106
  private asserts;
3096
3107
  private streamingAsserts;
@@ -3138,6 +3149,53 @@ declare class AxGenerateError extends Error {
3138
3149
  constructor(message: string, details: Readonly<AxGenerateErrorDetails>, options?: ErrorOptions);
3139
3150
  }
3140
3151
 
3152
+ type AxRewriteIn = {
3153
+ query: string;
3154
+ };
3155
+ type AxRewriteOut = {
3156
+ rewrittenQuery: string;
3157
+ };
3158
+ type AxRerankerIn = {
3159
+ query: string;
3160
+ items: string[];
3161
+ };
3162
+ type AxRerankerOut = {
3163
+ rankedItems: string[];
3164
+ };
3165
+ interface AxDBLoaderOptions {
3166
+ chunker?: (text: string) => string[];
3167
+ rewriter?: AxGen<AxRewriteIn, AxRewriteOut>;
3168
+ reranker?: AxGen<AxRerankerIn, AxRerankerOut>;
3169
+ }
3170
+ interface AxDBManagerArgs {
3171
+ ai: AxAIService;
3172
+ db: AxDBService;
3173
+ config?: AxDBLoaderOptions;
3174
+ }
3175
+ interface AxDBMatch {
3176
+ score: number;
3177
+ text: string;
3178
+ }
3179
+ declare class AxDBManager {
3180
+ private ai;
3181
+ private db;
3182
+ private chunker;
3183
+ private rewriter?;
3184
+ private reranker?;
3185
+ constructor({ ai, db, config }: Readonly<AxDBManagerArgs>);
3186
+ private defaultChunker;
3187
+ insert: (text: Readonly<string | string[]>, options?: Readonly<{
3188
+ batchSize?: number;
3189
+ maxWordsPerChunk?: number;
3190
+ minWordsPerChunk?: number;
3191
+ abortSignal?: AbortSignal;
3192
+ }>) => Promise<void>;
3193
+ query: (query: Readonly<string | string[] | number | number[]>, { topPercent, abortSignal, }?: Readonly<{
3194
+ topPercent?: number;
3195
+ abortSignal?: AbortSignal;
3196
+ }> | undefined) => Promise<AxDBMatch[][]>;
3197
+ }
3198
+
3141
3199
  declare class AxDefaultResultReranker extends AxGen<AxRerankerIn, AxRerankerOut> {
3142
3200
  constructor(options?: Readonly<AxProgramForwardOptions>);
3143
3201
  forward: (ai: Readonly<AxAIService>, input: Readonly<AxRerankerIn>, options?: Readonly<AxProgramForwardOptions>) => Promise<AxRerankerOut>;
@@ -3231,6 +3289,59 @@ declare const AxEvalUtil: {
3231
3289
  novelF1ScoreOptimized: typeof novelF1ScoreOptimized;
3232
3290
  };
3233
3291
 
3292
+ type AxOptimizerLoggerData = {
3293
+ name: 'OptimizationStart';
3294
+ value: {
3295
+ optimizerType: string;
3296
+ config: Record<string, unknown>;
3297
+ exampleCount: number;
3298
+ validationCount: number;
3299
+ };
3300
+ } | {
3301
+ name: 'RoundProgress';
3302
+ value: {
3303
+ round: number;
3304
+ totalRounds: number;
3305
+ currentScore: number;
3306
+ bestScore: number;
3307
+ configuration: Record<string, unknown>;
3308
+ };
3309
+ } | {
3310
+ name: 'EarlyStopping';
3311
+ value: {
3312
+ reason: string;
3313
+ finalScore: number;
3314
+ round: number;
3315
+ };
3316
+ } | {
3317
+ name: 'OptimizationComplete';
3318
+ value: {
3319
+ bestScore: number;
3320
+ bestConfiguration: Record<string, unknown>;
3321
+ stats: AxOptimizationStats;
3322
+ };
3323
+ } | {
3324
+ name: 'ConfigurationProposal';
3325
+ value: {
3326
+ type: 'instructions' | 'demos' | 'general';
3327
+ proposals: string[] | Record<string, unknown>[];
3328
+ count: number;
3329
+ };
3330
+ } | {
3331
+ name: 'BootstrappedDemos';
3332
+ value: {
3333
+ count: number;
3334
+ demos: unknown[];
3335
+ };
3336
+ } | {
3337
+ name: 'BestConfigFound';
3338
+ value: {
3339
+ config: Record<string, unknown>;
3340
+ score: number;
3341
+ };
3342
+ };
3343
+ type AxOptimizerLoggerFunction = (data: AxOptimizerLoggerData) => void;
3344
+
3234
3345
  type AxExample = Record<string, AxFieldValue>;
3235
3346
  type AxMetricFn = <T extends AxGenOut = AxGenOut>(arg0: Readonly<{
3236
3347
  prediction: T;
@@ -3251,6 +3362,7 @@ interface AxOptimizationProgress {
3251
3362
  successfulExamples: number;
3252
3363
  totalExamples: number;
3253
3364
  currentConfiguration?: Record<string, unknown>;
3365
+ bestConfiguration?: Record<string, unknown>;
3254
3366
  convergenceInfo?: {
3255
3367
  improvement: number;
3256
3368
  stagnationRounds: number;
@@ -3305,6 +3417,8 @@ type AxOptimizerArgs = {
3305
3417
  logger?: AxLoggerFunction;
3306
3418
  verbose?: boolean;
3307
3419
  seed?: number;
3420
+ debugOptimizer?: boolean;
3421
+ optimizerLogger?: AxOptimizerLoggerFunction;
3308
3422
  };
3309
3423
  interface AxOptimizationStats {
3310
3424
  totalCalls: number;
@@ -3316,6 +3430,8 @@ interface AxOptimizationStats {
3316
3430
  patienceExhausted: boolean;
3317
3431
  reason: string;
3318
3432
  };
3433
+ bestScore: number;
3434
+ bestConfiguration?: Record<string, unknown>;
3319
3435
  resourceUsage: {
3320
3436
  totalTokens: number;
3321
3437
  totalTime: number;
@@ -3422,7 +3538,7 @@ interface AxOptimizer<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGen
3422
3538
  * @param options Optional configuration options that can override constructor settings
3423
3539
  * @returns Optimization result containing demos, stats, and configuration
3424
3540
  */
3425
- compile(program: Readonly<AxProgram<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): Promise<AxOptimizerResult<OUT>>;
3541
+ compile(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): Promise<AxOptimizerResult<OUT>>;
3426
3542
  /**
3427
3543
  * Optimize a program with real-time streaming updates
3428
3544
  * @param program The program to optimize
@@ -3430,7 +3546,7 @@ interface AxOptimizer<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGen
3430
3546
  * @param options Optional configuration options
3431
3547
  * @returns Async iterator yielding optimization progress
3432
3548
  */
3433
- compileStream?(program: Readonly<AxProgram<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): AsyncIterableIterator<AxOptimizationProgress>;
3549
+ compileStream?(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): AsyncIterableIterator<AxOptimizationProgress>;
3434
3550
  /**
3435
3551
  * Multi-objective optimization using Pareto frontier
3436
3552
  * @param program The program to optimize
@@ -3438,7 +3554,7 @@ interface AxOptimizer<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGen
3438
3554
  * @param options Optional configuration options
3439
3555
  * @returns Pareto optimization result
3440
3556
  */
3441
- compilePareto?(program: Readonly<AxProgram<IN, OUT>>, metricFn: AxMultiMetricFn, options?: AxCompileOptions): Promise<AxParetoResult<OUT>>;
3557
+ compilePareto?(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMultiMetricFn, options?: AxCompileOptions): Promise<AxParetoResult<OUT>>;
3442
3558
  /**
3443
3559
  * Get current optimization statistics
3444
3560
  * @returns Current optimization statistics
@@ -3468,7 +3584,7 @@ interface AxOptimizer<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGen
3468
3584
  * @param program Program to validate
3469
3585
  * @returns Validation result with any issues found
3470
3586
  */
3471
- validateProgram?(program: Readonly<AxProgram<IN, OUT>>): {
3587
+ validateProgram?(program: Readonly<AxGen<IN, OUT>>): {
3472
3588
  isValid: boolean;
3473
3589
  issues: string[];
3474
3590
  suggestions: string[];
@@ -3515,11 +3631,11 @@ interface AxMiPROOptimizerOptions {
3515
3631
  interface AxBootstrapCompileOptions extends AxCompileOptions {
3516
3632
  validationExamples?: readonly AxExample[];
3517
3633
  maxDemos?: number;
3518
- teacherProgram?: Readonly<AxProgram<AxGenIn, AxGenOut>>;
3634
+ teacherProgram?: Readonly<AxGen<AxGenIn, AxGenOut>>;
3519
3635
  }
3520
3636
  interface AxMiPROCompileOptions extends AxCompileOptions {
3521
3637
  validationExamples?: readonly AxExample[];
3522
- teacher?: Readonly<AxProgram<AxGenIn, AxGenOut>>;
3638
+ teacher?: Readonly<AxGen<AxGenIn, AxGenOut>>;
3523
3639
  auto?: 'light' | 'medium' | 'heavy';
3524
3640
  instructionCandidates?: string[];
3525
3641
  customProposer?: (context: Readonly<{
@@ -3563,6 +3679,8 @@ declare abstract class AxBaseOptimizer<IN extends AxGenIn = AxGenIn, OUT extends
3563
3679
  protected readonly resumeFromCheckpoint?: string;
3564
3680
  protected readonly logger?: AxLoggerFunction;
3565
3681
  protected readonly verbose?: boolean;
3682
+ protected readonly debugOptimizer: boolean;
3683
+ protected readonly optimizerLogger?: AxOptimizerLoggerFunction;
3566
3684
  private currentRound;
3567
3685
  private scoreHistory;
3568
3686
  private configurationHistory;
@@ -3627,23 +3745,15 @@ declare abstract class AxBaseOptimizer<IN extends AxGenIn = AxGenIn, OUT extends
3627
3745
  /**
3628
3746
  * Abstract method that must be implemented by concrete optimizers
3629
3747
  */
3630
- abstract compile(program: Readonly<AxProgram<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): Promise<AxOptimizerResult<OUT>>;
3631
- /**
3632
- * Get current optimization statistics
3633
- */
3634
- getStats(): AxOptimizationStats;
3635
- /**
3636
- * Reset optimizer state for reuse with different programs
3637
- */
3638
- reset(): void;
3748
+ abstract compile(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): Promise<AxOptimizerResult<OUT>>;
3639
3749
  /**
3640
- * Basic program validation that can be extended by concrete optimizers
3750
+ * Optimize a program with real-time streaming updates
3751
+ * @param program The program to optimize
3752
+ * @param metricFn Evaluation metric function
3753
+ * @param options Optional configuration options
3754
+ * @returns Async iterator yielding optimization progress
3641
3755
  */
3642
- validateProgram(program: Readonly<AxProgram<IN, OUT>>): {
3643
- isValid: boolean;
3644
- issues: string[];
3645
- suggestions: string[];
3646
- };
3756
+ compileStream(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): AsyncIterableIterator<AxOptimizationProgress>;
3647
3757
  /**
3648
3758
  * Multi-objective optimization using Pareto frontier
3649
3759
  * Default implementation that leverages the single-objective compile method
@@ -3652,7 +3762,7 @@ declare abstract class AxBaseOptimizer<IN extends AxGenIn = AxGenIn, OUT extends
3652
3762
  * @param options Optional configuration options
3653
3763
  * @returns Pareto optimization result with frontier of non-dominated solutions
3654
3764
  */
3655
- compilePareto(program: Readonly<AxProgram<IN, OUT>>, metricFn: AxMultiMetricFn, options?: AxCompileOptions): Promise<AxParetoResult<OUT>>;
3765
+ compilePareto(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMultiMetricFn, options?: AxCompileOptions): Promise<AxParetoResult<OUT>>;
3656
3766
  /**
3657
3767
  * Generate solutions using different weighted combinations of objectives
3658
3768
  */
@@ -3711,8 +3821,7 @@ declare abstract class AxBaseOptimizer<IN extends AxGenIn = AxGenIn, OUT extends
3711
3821
  * Get the logger function with fallback hierarchy:
3712
3822
  * 1. Explicit logger passed to optimizer
3713
3823
  * 2. Logger from student AI service
3714
- * 3. Default optimizer logger
3715
- * 4. undefined if verbose is false
3824
+ * 3. undefined if verbose is false
3716
3825
  */
3717
3826
  protected getLogger(options?: AxCompileOptions): AxLoggerFunction | undefined;
3718
3827
  /**
@@ -3751,11 +3860,15 @@ declare abstract class AxBaseOptimizer<IN extends AxGenIn = AxGenIn, OUT extends
3751
3860
  * Record performance metrics
3752
3861
  */
3753
3862
  protected recordPerformanceMetrics(metricType: 'evaluation' | 'demo_generation' | 'metric_computation', duration: number, optimizerType: string): void;
3863
+ protected isOptimizerLoggingEnabled(options?: AxCompileOptions): boolean;
3864
+ protected getOptimizerLogger(options?: AxCompileOptions): AxOptimizerLoggerFunction | undefined;
3865
+ getStats(): AxOptimizationStats;
3866
+ reset(): void;
3754
3867
  }
3755
3868
 
3756
3869
  type AxEvaluateArgs<IN extends AxGenIn, OUT extends AxGenOut> = {
3757
3870
  ai: AxAIService;
3758
- program: Readonly<AxProgram<IN, OUT>>;
3871
+ program: Readonly<AxGen<IN, OUT>>;
3759
3872
  examples: Readonly<AxExample[]>;
3760
3873
  };
3761
3874
  declare class AxTestPrompt<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> {
@@ -3806,15 +3919,6 @@ declare class AxHFDataLoader {
3806
3919
 
3807
3920
  declare const axCreateDefaultColorLogger: (output?: (message: string) => void) => AxLoggerFunction;
3808
3921
  declare const axCreateDefaultTextLogger: (output?: (message: string) => void) => AxLoggerFunction;
3809
- /**
3810
- * Factory function to create an enhanced optimizer logger with clean visual formatting
3811
- * that works for all optimizer types using semantic tags for proper categorization
3812
- */
3813
- declare const axCreateOptimizerLogger: (output?: (message: string) => void) => AxLoggerFunction;
3814
- /**
3815
- * Default optimizer logger instance
3816
- */
3817
- declare const axDefaultOptimizerLogger: AxLoggerFunction;
3818
3922
 
3819
3923
  interface AxMetricsConfig {
3820
3924
  enabled: boolean;
@@ -3866,6 +3970,19 @@ declare const axCheckMetricsHealth: () => {
3866
3970
  declare const axUpdateMetricsConfig: (config: Readonly<Partial<AxMetricsConfig>>) => void;
3867
3971
  declare const axGetMetricsConfig: () => AxMetricsConfig;
3868
3972
 
3973
+ /**
3974
+ * Factory function to create a default optimizer logger with color formatting
3975
+ */
3976
+ declare const axCreateDefaultOptimizerColorLogger: (output?: (message: string) => void) => AxOptimizerLoggerFunction;
3977
+ /**
3978
+ * Factory function to create a text-only optimizer logger (no colors)
3979
+ */
3980
+ declare const axCreateDefaultOptimizerTextLogger: (output?: (message: string) => void) => AxOptimizerLoggerFunction;
3981
+ /**
3982
+ * Default optimizer logger instance with color formatting
3983
+ */
3984
+ declare const axDefaultOptimizerLogger: AxOptimizerLoggerFunction;
3985
+
3869
3986
  declare class AxBootstrapFewShot<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> extends AxBaseOptimizer<IN, OUT> {
3870
3987
  private maxRounds;
3871
3988
  private maxDemos;
@@ -3881,7 +3998,7 @@ declare class AxBootstrapFewShot<IN extends AxGenIn = AxGenIn, OUT extends AxGen
3881
3998
  options?: AxBootstrapOptimizerOptions;
3882
3999
  }>);
3883
4000
  private compileRound;
3884
- compile(program: Readonly<AxProgram<IN, OUT>>, metricFn: AxMetricFn, options?: AxBootstrapCompileOptions): Promise<AxOptimizerResult<OUT>>;
4001
+ compile(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMetricFn, options?: AxBootstrapCompileOptions): Promise<AxOptimizerResult<OUT>>;
3885
4002
  }
3886
4003
 
3887
4004
  interface AxMiPROResult<IN extends AxGenIn, OUT extends AxGenOut> extends AxOptimizerResult<OUT> {
@@ -3960,7 +4077,7 @@ declare class AxMiPRO<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGen
3960
4077
  /**
3961
4078
  * The main compile method to run MIPROv2 optimization
3962
4079
  */
3963
- compile(program: Readonly<AxProgram<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): Promise<AxMiPROResult<IN, OUT>>;
4080
+ compile(program: Readonly<AxGen<IN, OUT>>, metricFn: AxMetricFn, options?: AxCompileOptions): Promise<AxMiPROResult<IN, OUT>>;
3964
4081
  /**
3965
4082
  * Applies a configuration to an AxGen instance
3966
4083
  */
@@ -3984,7 +4101,7 @@ declare class AxMiPRO<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGen
3984
4101
  * @param program Program to validate
3985
4102
  * @returns Validation result with any issues found
3986
4103
  */
3987
- validateProgram(program: Readonly<AxProgram<IN, OUT>>): {
4104
+ validateProgram(_program: Readonly<AxGen<IN, OUT>>): {
3988
4105
  isValid: boolean;
3989
4106
  issues: string[];
3990
4107
  suggestions: string[];
@@ -4079,7 +4196,97 @@ declare const f: {
4079
4196
  };
4080
4197
  };
4081
4198
 
4199
+ /**
4200
+ * Analyzes mapping functions to extract state dependencies.
4201
+ *
4202
+ * This class is crucial for the automatic parallelization feature of AxFlow.
4203
+ * It determines which fields in the state object a mapping function accesses,
4204
+ * which allows the execution planner to understand dependencies between steps
4205
+ * and optimize execution by running independent steps in parallel.
4206
+ *
4207
+ * The analyzer uses two complementary approaches:
4208
+ * 1. Static analysis of the function source code
4209
+ * 2. Dynamic proxy-based tracking as a fallback
4210
+ *
4211
+ * This dual approach ensures robust dependency detection even for complex
4212
+ * mapping functions that might use destructuring, computed property access,
4213
+ * or other advanced JavaScript patterns.
4214
+ */
4215
+ declare class AxFlowDependencyAnalyzer {
4216
+ /**
4217
+ * Analyzes a mapping function to determine which state fields it depends on.
4218
+ *
4219
+ * This method is called for every execute step to understand what data
4220
+ * the step needs from the current state. This information is used to:
4221
+ * - Build the dependency graph for parallel execution
4222
+ * - Ensure steps execute in the correct order
4223
+ * - Optimize performance by identifying independent operations
4224
+ *
4225
+ * The analysis process:
4226
+ * 1. First tries static analysis by parsing the function source
4227
+ * 2. Falls back to proxy-based tracking for complex cases
4228
+ * 3. Returns a list of field names that the mapping function accesses
4229
+ *
4230
+ * @param mapping - The mapping function that transforms state to node inputs
4231
+ * @param _nodeName - The name of the node (currently unused but kept for future use)
4232
+ * @returns Array of field names that the mapping function depends on
4233
+ *
4234
+ * @example
4235
+ * ```typescript
4236
+ * // For a mapping like: state => ({ query: state.userInput, context: state.previousResult })
4237
+ * // This would return: ['userInput', 'previousResult']
4238
+ * ```
4239
+ */
4240
+ analyzeMappingDependencies(mapping: (state: any) => any, _nodeName: string): string[];
4241
+ /**
4242
+ * Creates a tracking proxy for dependency analysis.
4243
+ *
4244
+ * This is a public method that creates a proxy to track property access patterns.
4245
+ * It's used for testing and advanced dependency analysis scenarios.
4246
+ *
4247
+ * @param target - The target object to wrap with a proxy
4248
+ * @param accessed - Array to collect accessed property names
4249
+ * @returns Proxy object that tracks property access
4250
+ */
4251
+ createTrackingProxy(target: any, accessed: string[]): any;
4252
+ /**
4253
+ * Parses function source code to extract state dependencies using static analysis.
4254
+ *
4255
+ * This method analyzes the source code of a function to find patterns like
4256
+ * `state.fieldName` and extracts the field names as dependencies.
4257
+ *
4258
+ * @param functionSource - The source code of the function to analyze
4259
+ * @returns Array of field names found in the source code
4260
+ */
4261
+ parseStaticDependencies(functionSource: string): string[];
4262
+ /**
4263
+ * Creates a proxy object that tracks property access for dependency analysis.
4264
+ *
4265
+ * This proxy intercepts all property access on the state object and records
4266
+ * which fields are being accessed. It's used as a fallback when static analysis
4267
+ * can't determine dependencies (e.g., for destructuring or computed properties).
4268
+ *
4269
+ * The proxy works by:
4270
+ * 1. Intercepting all property access via the 'get' trap
4271
+ * 2. Recording accessed property names in the dependencies array
4272
+ * 3. Returning nested proxies for chained property access
4273
+ *
4274
+ * This allows detection of complex access patterns like:
4275
+ * - Destructuring: const { field1, field2 } = state
4276
+ * - Computed properties: state[dynamicKey]
4277
+ * - Nested access: state.nested.field
4278
+ *
4279
+ * @param dependencies - Array to collect dependency names (modified in place)
4280
+ * @returns Proxy object that tracks property access
4281
+ */
4282
+ private createDependencyTracker;
4283
+ }
4284
+
4082
4285
  type AxFlowState = Record<string, unknown>;
4286
+ interface AxFlowNodeDefinition {
4287
+ inputs: Record<string, unknown>;
4288
+ outputs: Record<string, unknown>;
4289
+ }
4083
4290
  type AxFlowStepFunction = (state: AxFlowState, context: Readonly<{
4084
4291
  mainAi: AxAIService;
4085
4292
  mainOptions?: AxProgramForwardOptions;
@@ -4088,15 +4295,21 @@ interface AxFlowDynamicContext {
4088
4295
  ai?: AxAIService;
4089
4296
  options?: AxProgramForwardOptions;
4090
4297
  }
4091
- type GetGenIn<T extends AxGen<AxGenIn, AxGenOut>> = T extends AxGen<infer IN, AxGenOut> ? IN : never;
4092
- type GetGenOut<T extends AxGen<AxGenIn, AxGenOut>> = T extends AxGen<AxGenIn, infer OUT> ? OUT : never;
4298
+ type GetGenIn<T extends AxProgrammable<AxGenIn, AxGenOut>> = T extends AxProgrammable<infer IN, AxGenOut> ? IN : never;
4299
+ type GetGenOut<T extends AxProgrammable<AxGenIn, AxGenOut>> = T extends AxProgrammable<AxGenIn, infer OUT> ? OUT : never;
4093
4300
  type InferAxGen<TSig extends string> = TSig extends string ? AxGen<AxGenIn, AxGenOut> : never;
4094
4301
  type NodeResultKey<TNodeName extends string> = `${TNodeName}Result`;
4095
4302
  type AddNodeResult<TState extends AxFlowState, TNodeName extends string, TNodeOut extends AxGenOut> = TState & {
4096
4303
  [K in NodeResultKey<TNodeName>]: TNodeOut;
4097
4304
  };
4098
- type AxFlowTypedParallelBranch<TNodes extends Record<string, AxGen<any, any>>, TState extends AxFlowState> = (subFlow: AxFlowTypedSubContext<TNodes, TState>) => AxFlowTypedSubContext<TNodes, AxFlowState>;
4099
- interface AxFlowTypedSubContext<TNodes extends Record<string, AxGen<any, any>>, TState extends AxFlowState> {
4305
+ /**
4306
+ * Interface for flows that can be tuned, executed, and used in compositions.
4307
+ * Provides methods for building and executing complex AI workflows.
4308
+ */
4309
+ interface AxFlowable<IN extends AxGenIn, OUT extends AxGenOut> extends AxProgrammable<IN, OUT> {
4310
+ }
4311
+ type AxFlowTypedParallelBranch<TNodes extends Record<string, AxProgrammable<any, any>>, TState extends AxFlowState> = (subFlow: AxFlowTypedSubContext<TNodes, TState>) => AxFlowTypedSubContext<TNodes, AxFlowState>;
4312
+ interface AxFlowTypedSubContext<TNodes extends Record<string, AxProgrammable<any, any>>, TState extends AxFlowState> {
4100
4313
  execute<TNodeName extends keyof TNodes & string>(nodeName: TNodeName, mapping: (state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext): AxFlowTypedSubContext<TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
4101
4314
  map<TNewState extends AxFlowState>(transform: (state: TState) => TNewState): AxFlowTypedSubContext<TNodes, TNewState>;
4102
4315
  executeSteps(initialState: TState, context: Readonly<{
@@ -4113,8 +4326,13 @@ interface AxFlowSubContext {
4113
4326
  mainOptions?: AxProgramForwardOptions;
4114
4327
  }>): Promise<AxFlowState>;
4115
4328
  }
4329
+ interface AxFlowBranchContext {
4330
+ predicate: (state: AxFlowState) => unknown;
4331
+ branches: Map<unknown, AxFlowStepFunction[]>;
4332
+ currentBranchValue?: unknown;
4333
+ }
4116
4334
  interface AxFlowExecutionStep {
4117
- type: 'execute' | 'map' | 'other';
4335
+ type: 'execute' | 'map' | 'merge' | 'other';
4118
4336
  nodeName?: string;
4119
4337
  dependencies: string[];
4120
4338
  produces: string[];
@@ -4125,6 +4343,204 @@ interface AxFlowParallelGroup {
4125
4343
  level: number;
4126
4344
  steps: AxFlowExecutionStep[];
4127
4345
  }
4346
+ interface AxFlowAutoParallelConfig {
4347
+ enabled: boolean;
4348
+ }
4349
+
4350
+ /**
4351
+ * Builds and manages the execution plan with automatic parallelization.
4352
+ *
4353
+ * This class is the core of AxFlow's performance optimization system.
4354
+ * It analyzes the dependency relationships between steps and creates
4355
+ * an optimized execution plan that maximizes parallelism while ensuring
4356
+ * correct execution order.
4357
+ *
4358
+ * Key responsibilities:
4359
+ * 1. **Dependency Analysis**: Tracks what fields each step depends on and produces
4360
+ * 2. **Parallel Grouping**: Groups independent steps that can run simultaneously
4361
+ * 3. **Execution Optimization**: Creates optimized execution functions that
4362
+ * run parallel groups concurrently
4363
+ * 4. **Signature Inference**: Provides data for automatic signature generation
4364
+ *
4365
+ * The planner works by building a directed acyclic graph (DAG) of dependencies
4366
+ * and then creating execution levels where all steps in a level can run in parallel.
4367
+ */
4368
+ declare class AxFlowExecutionPlanner {
4369
+ private steps;
4370
+ private parallelGroups;
4371
+ private readonly analyzer;
4372
+ private initialFields;
4373
+ /**
4374
+ * Adds an execution step to the plan for analysis and optimization.
4375
+ *
4376
+ * This method is called for every operation in the flow (execute, map, merge, etc.)
4377
+ * and performs dependency analysis to understand what the step needs and produces.
4378
+ * This information is crucial for building the parallel execution plan.
4379
+ *
4380
+ * The method handles different types of steps:
4381
+ * - **Execute steps**: LLM node operations that depend on specific state fields
4382
+ * - **Map steps**: Transformations that modify the state object
4383
+ * - **Merge steps**: Operations that combine results from branches or parallel operations
4384
+ * - **Other steps**: Generic operations that don't fit other categories
4385
+ *
4386
+ * @param stepFunction - The actual function to execute for this step
4387
+ * @param nodeName - Name of the node (for execute steps)
4388
+ * @param mapping - Function that maps state to node inputs (for execute steps)
4389
+ * @param stepType - Type of step for specialized analysis
4390
+ * @param mapTransform - Transformation function (for map steps)
4391
+ * @param mergeOptions - Options for merge operations (result key, merge function)
4392
+ */
4393
+ addExecutionStep(stepFunction: AxFlowStepFunction, nodeName?: string, mapping?: (state: any) => any, stepType?: 'execute' | 'map' | 'merge' | 'other', mapTransform?: (state: any) => any, mergeOptions?: {
4394
+ resultKey?: string;
4395
+ mergeFunction?: (...args: any[]) => any;
4396
+ }): void;
4397
+ /**
4398
+ * Analyzes a map transformation function to determine what fields it produces.
4399
+ *
4400
+ * This is a challenging problem because map transformations can produce arbitrary
4401
+ * new fields based on complex logic. The method uses a mock state approach:
4402
+ * 1. Creates a mock state with sample data
4403
+ * 2. Runs the transformation on the mock state
4404
+ * 3. Analyzes the result to see what fields were produced
4405
+ *
4406
+ * This approach works for most common transformation patterns but may miss
4407
+ * edge cases where the transformation behavior depends on specific data values.
4408
+ *
4409
+ * @param mapTransform - The map transformation function to analyze
4410
+ * @returns Array of field names that the transformation produces
4411
+ */
4412
+ private analyzeMapTransformation;
4413
+ /**
4414
+ * Creates a mock state with sample data for transformation analysis.
4415
+ *
4416
+ * This method builds a representative state object that includes:
4417
+ * - Initial fields from the flow input
4418
+ * - Result fields from previous steps with realistic structure
4419
+ * - Sample data that allows transformations to execute
4420
+ *
4421
+ * The mock state is used to run map transformations in a controlled
4422
+ * environment to determine what fields they produce.
4423
+ *
4424
+ * @returns Mock state object with sample data
4425
+ */
4426
+ private createMockState;
4427
+ /**
4428
+ * Creates appropriate mock values based on field names and patterns.
4429
+ */
4430
+ private createMockValue;
4431
+ /**
4432
+ * Analyzes what fields are produced by conditional merge operations.
4433
+ *
4434
+ * Conditional merges are complex because they don't transform data like map operations,
4435
+ * but instead select which branch's results to use based on a condition.
4436
+ * The challenge is determining what fields will be available after the merge
4437
+ * without knowing which branch will be taken at runtime.
4438
+ *
4439
+ * This method uses heuristics to determine the likely output fields:
4440
+ * 1. Look at recent execute steps (likely branch operations)
4441
+ * 2. If found, use their output fields as potential merge results
4442
+ * 3. Fallback to all execute step fields if no recent pattern is found
4443
+ *
4444
+ * The analysis assumes that branches in a conditional merge will produce
4445
+ * similar types of fields, so we can use any branch's fields as representative
4446
+ * of what the merge might produce.
4447
+ *
4448
+ * @returns string[] - Array of field names that the merge operation might produce
4449
+ */
4450
+ private analyzeBranchMergeFields;
4451
+ /**
4452
+ * Sets the initial fields and triggers parallel group rebuilding.
4453
+ *
4454
+ * This method is called once the flow knows what input fields are available.
4455
+ * It triggers the parallel group analysis which determines the optimal
4456
+ * execution strategy for the entire flow.
4457
+ *
4458
+ * @param fields - Array of field names available at the start of execution
4459
+ */
4460
+ setInitialFields(fields: string[]): void;
4461
+ /**
4462
+ * Rebuilds the parallel execution groups based on step dependencies.
4463
+ *
4464
+ * This is the core algorithm that creates the parallel execution plan.
4465
+ * It uses a level-by-level approach:
4466
+ *
4467
+ * 1. **Level 0**: Steps with no dependencies (can run immediately)
4468
+ * 2. **Level 1**: Steps that depend only on Level 0 outputs
4469
+ * 3. **Level N**: Steps that depend on outputs from previous levels
4470
+ *
4471
+ * Steps within the same level can run in parallel because they don't
4472
+ * depend on each other's outputs.
4473
+ *
4474
+ * The algorithm ensures:
4475
+ * - Correct execution order (dependencies are satisfied)
4476
+ * - Maximum parallelism (independent steps run simultaneously)
4477
+ * - Deadlock prevention (circular dependencies are detected)
4478
+ *
4479
+ * Time complexity: O(n²) where n is the number of steps
4480
+ * Space complexity: O(n) for tracking processed steps and available fields
4481
+ */
4482
+ private rebuildParallelGroups;
4483
+ /**
4484
+ * Gets all fields produced by previous steps.
4485
+ *
4486
+ * This is used by steps that depend on "everything produced so far"
4487
+ * such as map transformations and merge operations.
4488
+ *
4489
+ * @returns Array of all field names produced by previous steps
4490
+ */
4491
+ private getAllProducedFields;
4492
+ /**
4493
+ * Creates optimized execution functions that implement the parallel execution plan.
4494
+ *
4495
+ * This method converts the parallel groups into actual executable functions.
4496
+ * It creates a series of steps where:
4497
+ * - Single-step groups execute directly
4498
+ * - Multi-step groups execute in parallel using Promise.all()
4499
+ * - Results are properly merged to maintain state consistency
4500
+ *
4501
+ * The optimized execution can significantly improve performance for flows
4502
+ * with independent operations, especially I/O-bound operations like LLM calls.
4503
+ *
4504
+ * Performance benefits:
4505
+ * - Reduces total execution time for independent operations
4506
+ * - Maximizes CPU and I/O utilization
4507
+ * - Maintains correctness through dependency management
4508
+ *
4509
+ * @returns Array of optimized step functions ready for execution
4510
+ */
4511
+ createOptimizedExecution(): AxFlowStepFunction[];
4512
+ /**
4513
+ * Gets optimized execution steps for the flow.
4514
+ *
4515
+ * This method provides the optimized execution steps that can be used
4516
+ * to execute the flow with maximum parallelism while maintaining
4517
+ * dependency order.
4518
+ *
4519
+ * @returns Array of optimized step functions ready for execution
4520
+ */
4521
+ getOptimizedExecutionSteps(): AxFlowStepFunction[];
4522
+ /**
4523
+ * Gets detailed execution plan information for debugging and analysis.
4524
+ *
4525
+ * This method provides comprehensive information about the execution plan,
4526
+ * including step counts, parallel grouping details, and the complete
4527
+ * dependency structure. It's particularly useful for:
4528
+ * - Debugging execution flow issues
4529
+ * - Performance analysis and optimization
4530
+ * - Understanding parallelization effectiveness
4531
+ * - Monitoring execution plan complexity
4532
+ *
4533
+ * @returns Object containing detailed execution plan metrics and data
4534
+ */
4535
+ getExecutionPlan(): {
4536
+ totalSteps: number;
4537
+ parallelGroups: number;
4538
+ maxParallelism: number;
4539
+ steps: AxFlowExecutionStep[];
4540
+ groups: AxFlowParallelGroup[];
4541
+ };
4542
+ }
4543
+
4128
4544
  /**
4129
4545
  * AxFlow - A fluent, chainable API for building and orchestrating complex, stateful AI programs.
4130
4546
  *
@@ -4143,8 +4559,8 @@ interface AxFlowParallelGroup {
4143
4559
  * const result = await flow.forward(ai, { topic: "AI safety" })
4144
4560
  * ```
4145
4561
  */
4146
- declare class AxFlow<IN extends AxGenIn, OUT extends AxGenOut, TNodes extends Record<string, AxGen<any, any>> = Record<string, never>, // Node registry for type tracking
4147
- TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4562
+ declare class AxFlow<IN extends AxGenIn, OUT extends AxGenOut, TNodes extends Record<string, AxProgrammable<any, any>> = Record<string, never>, // Node registry for type tracking
4563
+ TState extends AxFlowState = IN> implements AxFlowable<IN, OUT> {
4148
4564
  private readonly nodes;
4149
4565
  private readonly flowDefinition;
4150
4566
  private readonly nodeGenerators;
@@ -4153,9 +4569,79 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4153
4569
  private branchContext;
4154
4570
  private readonly autoParallelConfig;
4155
4571
  private readonly executionPlanner;
4156
- constructor(signature?: NonNullable<ConstructorParameters<typeof AxSignature>[0]>, options?: {
4572
+ private program?;
4573
+ /**
4574
+ * Converts a string to camelCase for valid field names
4575
+ */
4576
+ private toCamelCase;
4577
+ /**
4578
+ * Infers the signature of the flow based on the execution plan and node definitions.
4579
+ * This is the core method that determines what input/output fields the flow should have
4580
+ * based on the nodes and operations defined in the flow.
4581
+ *
4582
+ * The inference process follows these steps:
4583
+ * 1. If no nodes are defined, return a default signature
4584
+ * 2. Analyze the execution plan to find all produced and consumed fields
4585
+ * 3. Determine input fields (consumed but not produced by any step)
4586
+ * 4. Determine output fields with special handling for final map/merge operations
4587
+ * 5. If no clear pattern is found, create a comprehensive signature from all nodes
4588
+ *
4589
+ * Special handling for final operations:
4590
+ * - Map operations: Use the fields produced by the map transformation
4591
+ * - Merge operations: Use fields from the merged branches or merge result
4592
+ * - Conditional merges: Analyze what fields the branches actually produce
4593
+ *
4594
+ * @returns AxSignature - The inferred signature for this flow
4595
+ */
4596
+ private inferSignatureFromFlow;
4597
+ constructor(options?: {
4157
4598
  autoParallel?: boolean;
4158
4599
  });
4600
+ /**
4601
+ * Initializes the program field every time something is added to the graph
4602
+ */
4603
+ private ensureProgram;
4604
+ setExamples(examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>): void;
4605
+ setId(id: string): void;
4606
+ setParentId(parentId: string): void;
4607
+ getTraces(): AxProgramTrace<IN, OUT>[];
4608
+ setDemos(demos: readonly AxProgramDemos<IN, OUT>[]): void;
4609
+ getUsage(): AxProgramUsage[];
4610
+ resetUsage(): void;
4611
+ streamingForward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
4612
+ /**
4613
+ * Executes the flow with the given AI service and input values.
4614
+ *
4615
+ * This is the main execution method that orchestrates the entire flow execution.
4616
+ * It handles several complex aspects:
4617
+ *
4618
+ * 1. **Dynamic Signature Inference**: If the flow was created with a default signature
4619
+ * but has nodes defined, it will infer the actual signature from the flow structure.
4620
+ *
4621
+ * 2. **Execution Mode Selection**: Chooses between optimized parallel execution
4622
+ * (when auto-parallel is enabled) or sequential execution based on configuration.
4623
+ *
4624
+ * 3. **State Management**: Maintains the evolving state object as it flows through
4625
+ * each step, accumulating results and transformations.
4626
+ *
4627
+ * 4. **Performance Optimization**: Uses the execution planner to identify
4628
+ * independent operations that can run in parallel, reducing total execution time.
4629
+ *
4630
+ * Execution Flow:
4631
+ * - Initialize state with input values
4632
+ * - Infer signature if needed (based on nodes and current signature)
4633
+ * - Choose execution strategy (parallel vs sequential)
4634
+ * - Execute all steps while maintaining state consistency
4635
+ * - Return final state cast to expected output type
4636
+ *
4637
+ * @param ai - The AI service to use as the default for all steps
4638
+ * @param values - The input values for the flow
4639
+ * @param options - Optional forward options to use as defaults (includes autoParallel override)
4640
+ * @returns Promise that resolves to the final output
4641
+ */
4642
+ forward(ai: Readonly<AxAIService>, values: IN | AxMessage<IN>[], options?: Readonly<AxProgramForwardOptions & {
4643
+ autoParallel?: boolean;
4644
+ }>): Promise<OUT>;
4159
4645
  /**
4160
4646
  * Declares a reusable computational node using a signature string.
4161
4647
  * Returns a new AxFlow type that tracks this node in the TNodes registry.
@@ -4194,24 +4680,6 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4194
4680
  [K in TName]: AxGen<AxGenIn, AxGenOut>;
4195
4681
  }, // Add new node to registry
4196
4682
  TState>;
4197
- /**
4198
- * Declares a reusable computational node using an existing AxGen instance.
4199
- * This allows reusing pre-configured generators in the flow.
4200
- *
4201
- * @param name - The name of the node
4202
- * @param axgenInstance - Existing AxGen instance to use for this node
4203
- * @returns New AxFlow instance with updated TNodes type
4204
- *
4205
- * @example
4206
- * ```typescript
4207
- * const summarizer = new AxGen('text:string -> summary:string', { temperature: 0.1 })
4208
- * flow.node('summarizer', summarizer)
4209
- * ```
4210
- */
4211
- node<TName extends string, TGen extends AxGen<any, any>>(name: TName, axgenInstance: TGen): AxFlow<IN, OUT, TNodes & {
4212
- [K in TName]: TGen;
4213
- }, // Add new node to registry with exact type
4214
- TState>;
4215
4683
  /**
4216
4684
  * Declares a reusable computational node using a class that extends AxProgram.
4217
4685
  * This allows using custom program classes in the flow.
@@ -4228,10 +4696,22 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4228
4696
  * flow.node('custom', CustomProgram)
4229
4697
  * ```
4230
4698
  */
4231
- node<TName extends string, TProgram extends new () => AxProgram<any, any>>(name: TName, programClass: TProgram): AxFlow<IN, OUT, TNodes & {
4699
+ node<TName extends string, TProgram extends new () => AxProgrammable<any, any>>(name: TName, programClass: TProgram): AxFlow<IN, OUT, TNodes & {
4232
4700
  [K in TName]: InstanceType<TProgram>;
4233
4701
  }, // Add new node to registry with exact type
4234
4702
  TState>;
4703
+ /**
4704
+ * Declares a reusable computational node using an AxProgrammable instance.
4705
+ * This allows using pre-configured AxGen instances or other programmable objects in the flow.
4706
+ *
4707
+ * @param name - The name of the node
4708
+ * @param programInstance - The AxProgrammable instance to use for this node
4709
+ * @returns New AxFlow instance with updated TNodes type
4710
+ */
4711
+ node<TName extends string, TProgram extends AxProgrammable<any, any>>(name: TName, programInstance: TProgram): AxFlow<IN, OUT, TNodes & {
4712
+ [K in TName]: TProgram;
4713
+ }, // Add new node to registry with exact type
4714
+ TState>;
4235
4715
  /**
4236
4716
  * Short alias for node() - supports signature strings, AxSignature instances, AxGen instances, and program classes
4237
4717
  */
@@ -4241,12 +4721,12 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4241
4721
  n<TName extends string>(name: TName, signature: AxSignature, options?: Readonly<AxProgramForwardOptions>): AxFlow<IN, OUT, TNodes & {
4242
4722
  [K in TName]: AxGen<AxGenIn, AxGenOut>;
4243
4723
  }, TState>;
4244
- n<TName extends string, TGen extends AxGen<any, any>>(name: TName, axgenInstance: TGen): AxFlow<IN, OUT, TNodes & {
4245
- [K in TName]: TGen;
4246
- }, TState>;
4247
- n<TName extends string, TProgram extends new () => AxProgram<any, any>>(name: TName, programClass: TProgram): AxFlow<IN, OUT, TNodes & {
4724
+ n<TName extends string, TProgram extends new () => AxProgrammable<any, any>>(name: TName, programClass: TProgram): AxFlow<IN, OUT, TNodes & {
4248
4725
  [K in TName]: InstanceType<TProgram>;
4249
4726
  }, TState>;
4727
+ n<TName extends string, TProgram extends AxProgrammable<any, any>>(name: TName, programInstance: TProgram): AxFlow<IN, OUT, TNodes & {
4728
+ [K in TName]: TProgram;
4729
+ }, TState>;
4250
4730
  /**
4251
4731
  * Applies a synchronous transformation to the state object.
4252
4732
  * Returns a new AxFlow type with the evolved state.
@@ -4259,11 +4739,11 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4259
4739
  * flow.map(state => ({ ...state, processedText: state.text.toLowerCase() }))
4260
4740
  * ```
4261
4741
  */
4262
- map<TNewState extends AxFlowState>(transform: (state: TState) => TNewState): AxFlow<IN, OUT, TNodes, TNewState>;
4742
+ map<TNewState extends AxFlowState>(transform: (_state: TState) => TNewState): AxFlow<IN, OUT, TNodes, TNewState>;
4263
4743
  /**
4264
4744
  * Short alias for map()
4265
4745
  */
4266
- m<TNewState extends AxFlowState>(transform: (state: TState) => TNewState): AxFlow<IN, OUT, TNodes, TNewState>;
4746
+ m<TNewState extends AxFlowState>(transform: (_state: TState) => TNewState): AxFlow<IN, OUT, TNodes, TNewState>;
4267
4747
  /**
4268
4748
  * Labels a step for later reference (useful for feedback loops).
4269
4749
  *
@@ -4295,11 +4775,11 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4295
4775
  * flow.execute('summarizer', state => ({ text: state.originalText }), { ai: cheapAI })
4296
4776
  * ```
4297
4777
  */
4298
- execute<TNodeName extends keyof TNodes & string>(nodeName: TNodeName, mapping: (state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
4778
+ execute<TNodeName extends keyof TNodes & string>(nodeName: TNodeName, mapping: (_state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
4299
4779
  /**
4300
4780
  * Short alias for execute()
4301
4781
  */
4302
- e<TNodeName extends keyof TNodes & string>(nodeName: TNodeName, mapping: (state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
4782
+ e<TNodeName extends keyof TNodes & string>(nodeName: TNodeName, mapping: (_state: TState) => GetGenIn<TNodes[TNodeName]>, dynamicContext?: AxFlowDynamicContext): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;
4303
4783
  /**
4304
4784
  * Starts a conditional branch based on a predicate function.
4305
4785
  *
@@ -4316,11 +4796,11 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4316
4796
  * .merge()
4317
4797
  * ```
4318
4798
  */
4319
- branch(predicate: (state: TState) => unknown): this;
4799
+ branch(predicate: (_state: TState) => unknown): this;
4320
4800
  /**
4321
4801
  * Short alias for branch()
4322
4802
  */
4323
- b(predicate: (state: TState) => unknown): this;
4803
+ b(predicate: (_state: TState) => unknown): this;
4324
4804
  /**
4325
4805
  * Defines a branch case for the current branch context.
4326
4806
  *
@@ -4333,25 +4813,34 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4333
4813
  */
4334
4814
  w(value: unknown): this;
4335
4815
  /**
4336
- * Ends the current branch and merges all branch paths back into the main flow.
4337
- * Optionally specify the explicit merged state type for better type safety.
4816
+ * Merges the results of conditional branches into a single execution path.
4817
+ *
4818
+ * This method is called after defining conditional branches with branch() and when() methods.
4819
+ * It creates a merge point where the flow continues with the results from whichever
4820
+ * branch was executed based on the branch condition.
4821
+ *
4822
+ * How conditional merging works:
4823
+ * 1. The branch predicate is evaluated against the current state
4824
+ * 2. The matching branch's steps are executed sequentially
4825
+ * 3. If no branch matches, the state is returned unchanged
4826
+ * 4. The merged result becomes the new state for subsequent steps
4827
+ *
4828
+ * Type safety note:
4829
+ * The TMergedState generic allows for type-level tracking of what fields
4830
+ * will be available after the merge, though runtime behavior depends on
4831
+ * which branch actually executes.
4338
4832
  *
4339
- * @param explicitMergedType - Optional type hint for the merged state (defaults to current TState)
4340
- * @returns AxFlow instance with the merged state type
4833
+ * @returns AxFlow with updated state type reflecting the merged result
4341
4834
  *
4342
4835
  * @example
4343
4836
  * ```typescript
4344
- * // Default behavior - preserves current TState
4345
- * flow.branch(state => state.type)
4346
- * .when('simple').execute('simpleProcessor', ...)
4347
- * .when('complex').execute('complexProcessor', ...)
4348
- * .merge()
4349
- *
4350
- * // Explicit type - specify exact merged state shape
4351
- * flow.branch(state => state.type)
4352
- * .when('simple').map(state => ({ result: state.simpleResult, method: 'simple' }))
4353
- * .when('complex').map(state => ({ result: state.complexResult, method: 'complex' }))
4354
- * .merge<{ result: string; method: string }>()
4837
+ * flow
4838
+ * .branch(state => state.complexity > 0.5)
4839
+ * .when(true)
4840
+ * .execute('complexProcessor', state => ({ input: state.text }))
4841
+ * .when(false)
4842
+ * .execute('simpleProcessor', state => ({ input: state.text }))
4843
+ * .merge() // Combines results from either branch
4355
4844
  * ```
4356
4845
  */
4357
4846
  merge<TMergedState extends AxFlowState = TState>(): AxFlow<IN, OUT, TNodes, TMergedState>;
@@ -4360,8 +4849,24 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4360
4849
  */
4361
4850
  mg<TMergedState extends AxFlowState = TState>(): AxFlow<IN, OUT, TNodes, TMergedState>;
4362
4851
  /**
4363
- * Executes multiple operations in parallel and merges their results.
4364
- * Both typed and legacy untyped branches are supported.
4852
+ * Executes multiple operations in parallel and provides a merge method for combining results.
4853
+ *
4854
+ * This method enables true parallel execution of independent operations, which is particularly
4855
+ * useful for operations like:
4856
+ * - Multiple document retrievals
4857
+ * - Parallel processing of different data sources
4858
+ * - Independent LLM calls that can run simultaneously
4859
+ *
4860
+ * How parallel execution works:
4861
+ * 1. Each branch function receives a sub-context for defining operations
4862
+ * 2. All branches are executed simultaneously using Promise.all()
4863
+ * 3. Results are stored in _parallelResults for the merge operation
4864
+ * 4. The merge function combines the results into a single field
4865
+ *
4866
+ * Performance benefits:
4867
+ * - Reduces total execution time for independent operations
4868
+ * - Maximizes throughput for I/O-bound operations (like LLM calls)
4869
+ * - Maintains type safety through the merge operation
4365
4870
  *
4366
4871
  * @param branches - Array of functions that define parallel operations
4367
4872
  * @returns Object with merge method for combining results
@@ -4376,7 +4881,7 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4376
4881
  * ```
4377
4882
  */
4378
4883
  parallel(branches: (AxFlowParallelBranch | AxFlowTypedParallelBranch<TNodes, TState>)[]): {
4379
- merge<T, TResultKey extends string>(resultKey: TResultKey, mergeFunction: (...results: unknown[]) => T): AxFlow<IN, OUT, TNodes, TState & {
4884
+ merge<T, TResultKey extends string>(resultKey: TResultKey, mergeFunction: (..._results: unknown[]) => T): AxFlow<IN, OUT, TNodes, TState & {
4380
4885
  [K in TResultKey]: T;
4381
4886
  }>;
4382
4887
  };
@@ -4384,7 +4889,7 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4384
4889
  * Short alias for parallel()
4385
4890
  */
4386
4891
  p(branches: (AxFlowParallelBranch | AxFlowTypedParallelBranch<TNodes, TState>)[]): {
4387
- merge<T, TResultKey extends string>(resultKey: TResultKey, mergeFunction: (...results: unknown[]) => T): AxFlow<IN, OUT, TNodes, TState & {
4892
+ merge<T, TResultKey extends string>(resultKey: TResultKey, mergeFunction: (..._results: unknown[]) => T): AxFlow<IN, OUT, TNodes, TState & {
4388
4893
  [K in TResultKey]: T;
4389
4894
  }>;
4390
4895
  };
@@ -4404,11 +4909,11 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4404
4909
  * .feedback(state => state.qualityCheckResult.confidence < 0.7, 'retry-point')
4405
4910
  * ```
4406
4911
  */
4407
- feedback(condition: (state: TState) => boolean, targetLabel: string, maxIterations?: number): this;
4912
+ feedback(condition: (_state: TState) => boolean, targetLabel: string, maxIterations?: number): this;
4408
4913
  /**
4409
4914
  * Short alias for feedback()
4410
4915
  */
4411
- fb(condition: (state: TState) => boolean, targetLabel: string, maxIterations?: number): this;
4916
+ fb(condition: (_state: TState) => boolean, targetLabel: string, maxIterations?: number): this;
4412
4917
  /**
4413
4918
  * Marks the beginning of a loop block.
4414
4919
  *
@@ -4427,7 +4932,7 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4427
4932
  /**
4428
4933
  * Short alias for while()
4429
4934
  */
4430
- wh(condition: (state: TState) => boolean, maxIterations?: number): this;
4935
+ wh(condition: (_state: TState) => boolean, maxIterations?: number): this;
4431
4936
  /**
4432
4937
  * Marks the end of a loop block.
4433
4938
  *
@@ -4438,17 +4943,6 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4438
4943
  * Short alias for endWhile()
4439
4944
  */
4440
4945
  end(): this;
4441
- /**
4442
- * Executes the flow with the given AI service and input values.
4443
- *
4444
- * @param ai - The AI service to use as the default for all steps
4445
- * @param values - The input values for the flow
4446
- * @param options - Optional forward options to use as defaults (includes autoParallel override)
4447
- * @returns Promise that resolves to the final output
4448
- */
4449
- forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions & {
4450
- autoParallel?: boolean;
4451
- }>): Promise<OUT>;
4452
4946
  /**
4453
4947
  * Gets execution plan information for debugging automatic parallelization
4454
4948
  *
@@ -4462,6 +4956,22 @@ TState extends AxFlowState = IN> extends AxProgram<IN, OUT> {
4462
4956
  steps?: AxFlowExecutionStep[];
4463
4957
  groups?: AxFlowParallelGroup[];
4464
4958
  };
4959
+ getSignature(): AxSignature;
4960
+ }
4961
+
4962
+ /**
4963
+ * Implementation of the sub-context for parallel execution
4964
+ */
4965
+ declare class AxFlowSubContextImpl implements AxFlowSubContext {
4966
+ private readonly nodeGenerators;
4967
+ private readonly steps;
4968
+ constructor(nodeGenerators: Map<string, AxForwardable<AxGenIn, AxGenOut> & AxTunable<AxGenIn, AxGenOut> & AxUsable>);
4969
+ execute(nodeName: string, mapping: (state: AxFlowState) => Record<string, AxFieldValue>, dynamicContext?: AxFlowDynamicContext): this;
4970
+ map(transform: (state: AxFlowState) => AxFlowState): this;
4971
+ executeSteps(initialState: AxFlowState, context: Readonly<{
4972
+ mainAi: AxAIService;
4973
+ mainOptions?: AxProgramForwardOptions;
4974
+ }>): Promise<AxFlowState>;
4465
4975
  }
4466
4976
  /**
4467
4977
  * Typed implementation of the sub-context for parallel execution with full type safety
@@ -4780,7 +5290,7 @@ declare class AxMCPStreambleHTTPTransport implements AxMCPTransport {
4780
5290
  * Interface for agents that can be used as child agents.
4781
5291
  * Provides methods to get the agent's function definition and features.
4782
5292
  */
4783
- interface AxAgentic<IN extends AxGenIn, OUT extends AxGenOut> extends AxTunable<IN, OUT>, AxUsable {
5293
+ interface AxAgentic<IN extends AxGenIn, OUT extends AxGenOut> extends AxProgrammable<IN, OUT> {
4784
5294
  getFunction(): AxFunction;
4785
5295
  getFeatures(): AxAgentFeatures;
4786
5296
  }
@@ -4846,6 +5356,8 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
4846
5356
  */
4847
5357
  setDescription(description: string): void;
4848
5358
  setDefinition(definition: string): void;
5359
+ getSignature(): AxSignature;
5360
+ setSignature(signature: NonNullable<ConstructorParameters<typeof AxSignature>[0]>): void;
4849
5361
  private getDebug;
4850
5362
  }
4851
5363
 
@@ -4949,4 +5461,4 @@ declare class AxRateLimiterTokenUsage {
4949
5461
  acquire(tokens: number): Promise<void>;
4950
5462
  }
4951
5463
 
4952
- 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 AxAIAnthropicThinkingConfig, type AxAIAnthropicThinkingTokenBudgetLevels, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, 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, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, type AxAIGoogleGeminiContentPart, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiThinkingTokenBudgetLevels, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, type AxAIGrokChatRequest, AxAIGrokEmbedModels, AxAIGrokModel, type AxAIGrokOptionsTools, type AxAIGrokSearchSource, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, type AxAIMetricsInstruments, AxAIMistral, type AxAIMistralArgs, type AxAIMistralChatRequest, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModelListBase, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIAnnotation, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, AxAIOpenAIResponses, type AxAIOpenAIResponsesArgs, AxAIOpenAIResponsesBase, type AxAIOpenAIResponsesCodeInterpreterToolCall, type AxAIOpenAIResponsesComputerToolCall, type AxAIOpenAIResponsesConfig, type AxAIOpenAIResponsesContentPartAddedEvent, type AxAIOpenAIResponsesContentPartDoneEvent, type AxAIOpenAIResponsesDefineFunctionTool, type AxAIOpenAIResponsesErrorEvent, type AxAIOpenAIResponsesFileSearchCallCompletedEvent, type AxAIOpenAIResponsesFileSearchCallInProgressEvent, type AxAIOpenAIResponsesFileSearchCallSearchingEvent, type AxAIOpenAIResponsesFileSearchToolCall, type AxAIOpenAIResponsesFunctionCallArgumentsDeltaEvent, type AxAIOpenAIResponsesFunctionCallArgumentsDoneEvent, type AxAIOpenAIResponsesFunctionCallItem, type AxAIOpenAIResponsesImageGenerationCallCompletedEvent, type AxAIOpenAIResponsesImageGenerationCallGeneratingEvent, type AxAIOpenAIResponsesImageGenerationCallInProgressEvent, type AxAIOpenAIResponsesImageGenerationCallPartialImageEvent, type AxAIOpenAIResponsesImageGenerationToolCall, AxAIOpenAIResponsesImpl, type AxAIOpenAIResponsesInputAudioContentPart, type AxAIOpenAIResponsesInputContentPart, type AxAIOpenAIResponsesInputFunctionCallItem, type AxAIOpenAIResponsesInputFunctionCallOutputItem, type AxAIOpenAIResponsesInputImageUrlContentPart, type AxAIOpenAIResponsesInputItem, type AxAIOpenAIResponsesInputMessageItem, type AxAIOpenAIResponsesInputTextContentPart, type AxAIOpenAIResponsesLocalShellToolCall, type AxAIOpenAIResponsesMCPCallArgumentsDeltaEvent, type AxAIOpenAIResponsesMCPCallArgumentsDoneEvent, type AxAIOpenAIResponsesMCPCallCompletedEvent, type AxAIOpenAIResponsesMCPCallFailedEvent, type AxAIOpenAIResponsesMCPCallInProgressEvent, type AxAIOpenAIResponsesMCPListToolsCompletedEvent, type AxAIOpenAIResponsesMCPListToolsFailedEvent, type AxAIOpenAIResponsesMCPListToolsInProgressEvent, type AxAIOpenAIResponsesMCPToolCall, AxAIOpenAIResponsesModel, type AxAIOpenAIResponsesOutputItem, type AxAIOpenAIResponsesOutputItemAddedEvent, type AxAIOpenAIResponsesOutputItemDoneEvent, type AxAIOpenAIResponsesOutputMessageItem, type AxAIOpenAIResponsesOutputRefusalContentPart, type AxAIOpenAIResponsesOutputTextAnnotationAddedEvent, type AxAIOpenAIResponsesOutputTextContentPart, type AxAIOpenAIResponsesOutputTextDeltaEvent, type AxAIOpenAIResponsesOutputTextDoneEvent, type AxAIOpenAIResponsesReasoningDeltaEvent, type AxAIOpenAIResponsesReasoningDoneEvent, type AxAIOpenAIResponsesReasoningItem, type AxAIOpenAIResponsesReasoningSummaryDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryDoneEvent, type AxAIOpenAIResponsesReasoningSummaryPart, type AxAIOpenAIResponsesReasoningSummaryPartAddedEvent, type AxAIOpenAIResponsesReasoningSummaryPartDoneEvent, type AxAIOpenAIResponsesReasoningSummaryTextDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryTextDoneEvent, type AxAIOpenAIResponsesRefusalDeltaEvent, type AxAIOpenAIResponsesRefusalDoneEvent, type AxAIOpenAIResponsesRequest, type AxAIOpenAIResponsesResponse, type AxAIOpenAIResponsesResponseCompletedEvent, type AxAIOpenAIResponsesResponseCreatedEvent, type AxAIOpenAIResponsesResponseDelta, type AxAIOpenAIResponsesResponseFailedEvent, type AxAIOpenAIResponsesResponseInProgressEvent, type AxAIOpenAIResponsesResponseIncompleteEvent, type AxAIOpenAIResponsesResponseQueuedEvent, type AxAIOpenAIResponsesStreamEvent, type AxAIOpenAIResponsesStreamEventBase, type AxAIOpenAIResponsesToolCall, type AxAIOpenAIResponsesToolCallBase, type AxAIOpenAIResponsesToolChoice, type AxAIOpenAIResponsesToolDefinition, type AxAIOpenAIResponsesWebSearchCallCompletedEvent, type AxAIOpenAIResponsesWebSearchCallInProgressEvent, type AxAIOpenAIResponsesWebSearchCallSearchingEvent, type AxAIOpenAIResponsesWebSearchToolCall, type AxAIOpenAIUrlCitation, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIRefusalError, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, AxAIServiceAbortedError, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBaseOptimizer, type AxBootstrapCompileOptions, AxBootstrapFewShot, type AxBootstrapOptimizerOptions, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, type AxCheckpointLoadFn, type AxCheckpointSaveFn, type AxCompileOptions, type AxCostTracker, type AxCostTrackerOptions, 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, AxDefaultCostTracker, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, type AxErrorCategory, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldDescriptor, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldType, type AxFieldValue, AxFlow, AxFlowTypedSubContextImpl, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, type AxFunctionResult, type AxFunctionResultFormatter, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenMetricsInstruments, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxLLMRequestTypeValues, type AxLoggerFunction, type AxLoggerTag, AxMCPClient, AxMCPHTTPSSETransport, type AxMCPStreamableHTTPTransportOptions, AxMCPStreambleHTTPTransport, type AxMCPTransport, AxMemory, type AxMemoryData, type AxMessage, type AxMetricFn, type AxMetricFnArgs, type AxMetricsConfig, AxMiPRO, type AxMiPROCompileOptions, type AxMiPROOptimizerOptions, type AxMiPROResult, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, type AxMultiMetricFn, AxMultiServiceRouter, type AxOptimizationCheckpoint, type AxOptimizationProgress, type AxOptimizationStats, type AxOptimizer, type AxOptimizerArgs, type AxOptimizerMetricsConfig, type AxOptimizerMetricsInstruments, type AxOptimizerResult, type AxParetoResult, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxPromptTemplate, type AxPromptTemplateOptions, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxResultPickerFunction, type AxResultPickerFunctionFieldResults, type AxResultPickerFunctionFunctionResults, type AxRewriteIn, type AxRewriteOut, type AxSamplePickerOptions, type AxSetExamplesOptions, AxSignature, type AxSignatureConfig, type AxSignatureTemplateValue, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, ax, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIOpenAIResponsesBestConfig, axAIOpenAIResponsesCreativeConfig, axAIOpenAIResponsesDefaultConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axCheckMetricsHealth, axCreateDefaultColorLogger, axCreateDefaultTextLogger, axCreateOptimizerLogger, axDefaultMetricsConfig, axDefaultOptimizerLogger, axDefaultOptimizerMetricsConfig, axGetMetricsConfig, axGetOptimizerMetricsConfig, axGlobals, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoOpenAIResponses, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents, axUpdateMetricsConfig, axUpdateOptimizerMetricsConfig, axValidateChatRequestMessage, axValidateChatResponseResult, f, s };
5464
+ 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 AxAIAnthropicThinkingConfig, type AxAIAnthropicThinkingTokenBudgetLevels, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, 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, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, type AxAIGoogleGeminiContentPart, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiThinkingTokenBudgetLevels, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, type AxAIGrokChatRequest, AxAIGrokEmbedModels, AxAIGrokModel, type AxAIGrokOptionsTools, type AxAIGrokSearchSource, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, type AxAIMetricsInstruments, AxAIMistral, type AxAIMistralArgs, type AxAIMistralChatRequest, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModelListBase, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIAnnotation, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, AxAIOpenAIResponses, type AxAIOpenAIResponsesArgs, AxAIOpenAIResponsesBase, type AxAIOpenAIResponsesCodeInterpreterToolCall, type AxAIOpenAIResponsesComputerToolCall, type AxAIOpenAIResponsesConfig, type AxAIOpenAIResponsesContentPartAddedEvent, type AxAIOpenAIResponsesContentPartDoneEvent, type AxAIOpenAIResponsesDefineFunctionTool, type AxAIOpenAIResponsesErrorEvent, type AxAIOpenAIResponsesFileSearchCallCompletedEvent, type AxAIOpenAIResponsesFileSearchCallInProgressEvent, type AxAIOpenAIResponsesFileSearchCallSearchingEvent, type AxAIOpenAIResponsesFileSearchToolCall, type AxAIOpenAIResponsesFunctionCallArgumentsDeltaEvent, type AxAIOpenAIResponsesFunctionCallArgumentsDoneEvent, type AxAIOpenAIResponsesFunctionCallItem, type AxAIOpenAIResponsesImageGenerationCallCompletedEvent, type AxAIOpenAIResponsesImageGenerationCallGeneratingEvent, type AxAIOpenAIResponsesImageGenerationCallInProgressEvent, type AxAIOpenAIResponsesImageGenerationCallPartialImageEvent, type AxAIOpenAIResponsesImageGenerationToolCall, AxAIOpenAIResponsesImpl, type AxAIOpenAIResponsesInputAudioContentPart, type AxAIOpenAIResponsesInputContentPart, type AxAIOpenAIResponsesInputFunctionCallItem, type AxAIOpenAIResponsesInputFunctionCallOutputItem, type AxAIOpenAIResponsesInputImageUrlContentPart, type AxAIOpenAIResponsesInputItem, type AxAIOpenAIResponsesInputMessageItem, type AxAIOpenAIResponsesInputTextContentPart, type AxAIOpenAIResponsesLocalShellToolCall, type AxAIOpenAIResponsesMCPCallArgumentsDeltaEvent, type AxAIOpenAIResponsesMCPCallArgumentsDoneEvent, type AxAIOpenAIResponsesMCPCallCompletedEvent, type AxAIOpenAIResponsesMCPCallFailedEvent, type AxAIOpenAIResponsesMCPCallInProgressEvent, type AxAIOpenAIResponsesMCPListToolsCompletedEvent, type AxAIOpenAIResponsesMCPListToolsFailedEvent, type AxAIOpenAIResponsesMCPListToolsInProgressEvent, type AxAIOpenAIResponsesMCPToolCall, AxAIOpenAIResponsesModel, type AxAIOpenAIResponsesOutputItem, type AxAIOpenAIResponsesOutputItemAddedEvent, type AxAIOpenAIResponsesOutputItemDoneEvent, type AxAIOpenAIResponsesOutputMessageItem, type AxAIOpenAIResponsesOutputRefusalContentPart, type AxAIOpenAIResponsesOutputTextAnnotationAddedEvent, type AxAIOpenAIResponsesOutputTextContentPart, type AxAIOpenAIResponsesOutputTextDeltaEvent, type AxAIOpenAIResponsesOutputTextDoneEvent, type AxAIOpenAIResponsesReasoningDeltaEvent, type AxAIOpenAIResponsesReasoningDoneEvent, type AxAIOpenAIResponsesReasoningItem, type AxAIOpenAIResponsesReasoningSummaryDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryDoneEvent, type AxAIOpenAIResponsesReasoningSummaryPart, type AxAIOpenAIResponsesReasoningSummaryPartAddedEvent, type AxAIOpenAIResponsesReasoningSummaryPartDoneEvent, type AxAIOpenAIResponsesReasoningSummaryTextDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryTextDoneEvent, type AxAIOpenAIResponsesRefusalDeltaEvent, type AxAIOpenAIResponsesRefusalDoneEvent, type AxAIOpenAIResponsesRequest, type AxAIOpenAIResponsesResponse, type AxAIOpenAIResponsesResponseCompletedEvent, type AxAIOpenAIResponsesResponseCreatedEvent, type AxAIOpenAIResponsesResponseDelta, type AxAIOpenAIResponsesResponseFailedEvent, type AxAIOpenAIResponsesResponseInProgressEvent, type AxAIOpenAIResponsesResponseIncompleteEvent, type AxAIOpenAIResponsesResponseQueuedEvent, type AxAIOpenAIResponsesStreamEvent, type AxAIOpenAIResponsesStreamEventBase, type AxAIOpenAIResponsesToolCall, type AxAIOpenAIResponsesToolCallBase, type AxAIOpenAIResponsesToolChoice, type AxAIOpenAIResponsesToolDefinition, type AxAIOpenAIResponsesWebSearchCallCompletedEvent, type AxAIOpenAIResponsesWebSearchCallInProgressEvent, type AxAIOpenAIResponsesWebSearchCallSearchingEvent, type AxAIOpenAIResponsesWebSearchToolCall, type AxAIOpenAIUrlCitation, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIRefusalError, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, AxAIServiceAbortedError, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBaseOptimizer, type AxBootstrapCompileOptions, AxBootstrapFewShot, type AxBootstrapOptimizerOptions, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, type AxCheckpointLoadFn, type AxCheckpointSaveFn, type AxCompileOptions, type AxCostTracker, type AxCostTrackerOptions, 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, AxDefaultCostTracker, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, type AxErrorCategory, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldDescriptor, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldType, type AxFieldValue, AxFlow, type AxFlowAutoParallelConfig, type AxFlowBranchContext, AxFlowDependencyAnalyzer, type AxFlowDynamicContext, AxFlowExecutionPlanner, type AxFlowExecutionStep, type AxFlowNodeDefinition, type AxFlowParallelBranch, type AxFlowParallelGroup, type AxFlowState, type AxFlowStepFunction, type AxFlowSubContext, AxFlowSubContextImpl, type AxFlowTypedParallelBranch, type AxFlowTypedSubContext, AxFlowTypedSubContextImpl, type AxFlowable, type AxForwardable, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, type AxFunctionResult, type AxFunctionResultFormatter, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenMetricsInstruments, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxLLMRequestTypeValues, type AxLoggerData, type AxLoggerFunction, AxMCPClient, AxMCPHTTPSSETransport, type AxMCPStreamableHTTPTransportOptions, AxMCPStreambleHTTPTransport, type AxMCPTransport, AxMemory, type AxMemoryData, type AxMessage, type AxMetricFn, type AxMetricFnArgs, type AxMetricsConfig, AxMiPRO, type AxMiPROCompileOptions, type AxMiPROOptimizerOptions, type AxMiPROResult, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, type AxMultiMetricFn, AxMultiServiceRouter, type AxOptimizationCheckpoint, type AxOptimizationProgress, type AxOptimizationStats, type AxOptimizer, type AxOptimizerArgs, type AxOptimizerLoggerData, type AxOptimizerLoggerFunction, type AxOptimizerMetricsConfig, type AxOptimizerMetricsInstruments, type AxOptimizerResult, type AxParetoResult, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, type AxProgrammable, AxPromptTemplate, type AxPromptTemplateOptions, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxResultPickerFunction, type AxResultPickerFunctionFieldResults, type AxResultPickerFunctionFunctionResults, type AxRewriteIn, type AxRewriteOut, type AxSamplePickerOptions, type AxSetExamplesOptions, AxSignature, type AxSignatureConfig, type AxSignatureTemplateValue, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, ax, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIOpenAIResponsesBestConfig, axAIOpenAIResponsesCreativeConfig, axAIOpenAIResponsesDefaultConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axCheckMetricsHealth, axCreateDefaultColorLogger, axCreateDefaultOptimizerColorLogger, axCreateDefaultOptimizerTextLogger, axCreateDefaultTextLogger, axDefaultMetricsConfig, axDefaultOptimizerLogger, axDefaultOptimizerMetricsConfig, axGetMetricsConfig, axGetOptimizerMetricsConfig, axGlobals, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoOpenAIResponses, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents, axUpdateMetricsConfig, axUpdateOptimizerMetricsConfig, axValidateChatRequestMessage, axValidateChatResponseResult, f, s };