AxFlow
Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L129
Interface for flows that can be tuned, executed, and used in compositions. Provides methods for building and executing complex AI workflows.
Type Parameters
| Type Parameter | Default type |
|---|---|
IN extends Record<string, any> | - |
OUT | - |
TNodes extends Record<string, AxProgrammable<any, any>> | Record<string, never> |
TState extends AxFlowState | IN |
Implements
AxFlowable<IN,OUT>AxFlowNodeExecutionRecorder
Methods
applyOptimization()
applyOptimization(optimizedProgram: AxOptimizedProgram<any>): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1142
Parameters
| Parameter | Type |
|---|---|
optimizedProgram | AxOptimizedProgram<any> |
Returns
void
Implementation of
applyOptimizedComponents()
applyOptimizedComponents(updates: Readonly<Record<string, string>>): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1169
Apply a map of componentKey → newValue updates produced by an optimizer.
Each program filters keys belonging to itself and dispatches internally.
Unknown keys are silently ignored, which lets parents broadcast a single
map across the whole subtree.
Parameters
| Parameter | Type |
|---|---|
updates | Readonly<Record<string, string>> |
Returns
void
Implementation of
AxFlowable.applyOptimizedComponents
b()
b(predicate: (_state: TState) => unknown): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1198
Parameters
| Parameter | Type |
|---|---|
predicate | (_state: TState) => unknown |
Returns
this
branch()
branch(predicate: (_state: TState) => unknown): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1185
Parameters
| Parameter | Type |
|---|---|
predicate | (_state: TState) => unknown |
Returns
this
derive()
derive<T>(
outputFieldName: string,
inputFieldName: string,
transformFn: (value: any, index?: number, state?: TState) => T,
options?: object): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1507
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
outputFieldName | string |
inputFieldName | string |
transformFn | (value: any, index?: number, state?: TState) => T |
options? | { batchSize?: number; } |
options.batchSize? | number |
Returns
this
description()
description(name: string, description: string): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L514
Parameters
| Parameter | Type |
|---|---|
name | string |
description | string |
Returns
this
e()
e<TNodeName, TAI>(
nodeName: TNodeName,
mapping: (_state: TState) => GetGenIn<TNodes[TNodeName]>,
dynamicContext?: AxFlowDynamicContext<TAI>): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1126
Type Parameters
| Type Parameter |
|---|
TNodeName extends string |
TAI extends Readonly<AxAIService<unknown, unknown, string>> |
Parameters
| Parameter | Type |
|---|---|
nodeName | TNodeName |
mapping | (_state: TState) => GetGenIn<TNodes[TNodeName]> |
dynamicContext? | AxFlowDynamicContext<TAI> |
Returns
AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>
end()
end(): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1503
Returns
this
endWhile()
endWhile(): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1455
Returns
this
execute()
execute<TNodeName, TAI>(
nodeName: TNodeName,
mapping: (_state: TState) => GetGenIn<TNodes[TNodeName]>,
dynamicContext?: AxFlowDynamicContext<TAI>): AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1104
Type Parameters
| Type Parameter |
|---|
TNodeName extends string |
TAI extends Readonly<AxAIService<unknown, unknown, string>> |
Parameters
| Parameter | Type |
|---|---|
nodeName | TNodeName |
mapping | (_state: TState) => GetGenIn<TNodes[TNodeName]> |
dynamicContext? | AxFlowDynamicContext<TAI> |
Returns
AxFlow<IN, OUT, TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>
fb()
fb(
condition: (_state: TState) => boolean,
targetLabel: string,
maxIterations: number): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1428
Parameters
| Parameter | Type | Default value |
|---|---|---|
condition | (_state: TState) => boolean | undefined |
targetLabel | string | undefined |
maxIterations | number | 10 |
Returns
this
feedback()
feedback(
condition: (_state: TState) => boolean,
targetLabel: string,
maxIterations: number): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1376
Parameters
| Parameter | Type | Default value |
|---|---|---|
condition | (_state: TState) => boolean | undefined |
targetLabel | string | undefined |
maxIterations | number | 10 |
Returns
this
forward()
forward<T>(
ai: T,
values: IN,
options?: Readonly<AxFlowForwardOptions<T>>): Promise<OUT>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L651
Type Parameters
| Type Parameter |
|---|
T extends Readonly<AxAIService<unknown, unknown, string>> |
Parameters
| Parameter | Type |
|---|---|
ai | T |
values | IN |
options? | Readonly<AxFlowForwardOptions<T>> |
Returns
Promise<OUT>
Implementation of
getChatLog()
getChatLog(): readonly AxChatLogEntry[];Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L559
Returns
readonly AxChatLogEntry[]
Implementation of
getExecutionPlan()
getExecutionPlan(): object;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1548
Returns
object
| Name | Type |
|---|---|
autoParallelEnabled | boolean |
groups? | AxFlowExecutionPlanGroup[] |
maxParallelism | number |
parallelGroups | number |
steps? | AxFlowExecutionPlanStep[] |
totalSteps | number |
getId()
getId(): string;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L474
Returns
string
Implementation of
getNodePrograms()
getNodePrograms(): readonly object[];Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L591
Returns
readonly object[]
getOptimizableComponents()
getOptimizableComponents(): readonly AxOptimizableComponent[];Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1153
Enumerate all string-valued artifacts this program tree exposes for reflective optimization (instructions, signature descriptions, function names/descriptions, agent system prompts, etc.). Composite programs flat-map their children’s components and append their own.
The optimizer never walks the tree — traversal is encapsulated here.
Returns
readonly AxOptimizableComponent[]
Implementation of
AxFlowable.getOptimizableComponents
getSignature()
getSignature(): AxSignature;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1596
Returns
Implementation of
getTraces()
getTraces(): AxProgramTrace<IN, OUT>[];Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L494
Returns
AxProgramTrace<IN, OUT>[]
Implementation of
getTracesReport()
getTracesReport(): Record<string, AxProgramTrace<any, any>[]>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L620
Returns
Record<string, AxProgramTrace<any, any>[]>
getUsage()
getUsage(): AxModelUsage & object[];Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L555
Returns
AxModelUsage & object[]
Implementation of
getUsageReport()
getUsageReport(): Record<string, AxProgramUsage[]>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L583
Returns
Record<string, AxProgramUsage[]>
l()
l(label: string): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1053
Parameters
| Parameter | Type |
|---|---|
label | string |
Returns
this
label()
label(label: string): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1042
Parameters
| Parameter | Type |
|---|---|
label | string |
Returns
this
m()
Call Signature
m<TNewState>(transform: (_state: TState) => TNewState): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L999
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transform | (_state: TState) => TNewState |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
Call Signature
m<TNewState>(transform: (_state: TState) => Promise<TNewState>): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1002
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transform | (_state: TState) => Promise<TNewState> |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
Call Signature
m<TNewState>(transforms: (_state: TState) => TNewState[], options: object): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1005
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transforms | (_state: TState) => TNewState[] |
options | { parallel: true; } |
options.parallel | true |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
Call Signature
m<TNewState>(transforms: (_state: TState) => Promise<TNewState>[], options: object): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1009
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transforms | (_state: TState) => Promise<TNewState>[] |
options | { parallel: true; } |
options.parallel | true |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
map()
Call Signature
map<TNewState>(transform: (_state: TState) => TNewState): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L948
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transform | (_state: TState) => TNewState |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
Call Signature
map<TNewState>(transform: (_state: TState) => Promise<TNewState>): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L951
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transform | (_state: TState) => Promise<TNewState> |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
Call Signature
map<TNewState>(transforms: (_state: TState) => TNewState[], options: object): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L954
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transforms | (_state: TState) => TNewState[] |
options | { parallel: true; } |
options.parallel | true |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
Call Signature
map<TNewState>(transforms: (_state: TState) => Promise<TNewState>[], options: object): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L958
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transforms | (_state: TState) => Promise<TNewState>[] |
options | { parallel: true; } |
options.parallel | true |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
Call Signature
map<TNewState>(transform: (_state: TState) => TNewState | Promise<TNewState>, options?: object): AxFlow<IN, OUT, TNodes, TNewState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L962
Type Parameters
| Type Parameter |
|---|
TNewState extends AxFlowState |
Parameters
| Parameter | Type |
|---|---|
transform | (_state: TState) => TNewState | Promise<TNewState> |
options? | { parallel?: boolean; } |
options.parallel? | boolean |
Returns
AxFlow<IN, OUT, TNodes, TNewState>
merge()
merge<TMergedState>(): AxFlow<IN, OUT, TNodes, TMergedState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1217
Type Parameters
| Type Parameter | Default type |
|---|---|
TMergedState extends AxFlowState | TState |
Returns
AxFlow<IN, OUT, TNodes, TMergedState>
mg()
mg<TMergedState>(): AxFlow<IN, OUT, TNodes, TMergedState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1261
Type Parameters
| Type Parameter | Default type |
|---|---|
TMergedState extends AxFlowState | TState |
Returns
AxFlow<IN, OUT, TNodes, TMergedState>
n()
Call Signature
n<TName, TSig>(name: TName, signature: TSig): AxFlow<IN, OUT, TNodes & { [K in string]: InferAxGen<TSig> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L913
Type Parameters
| Type Parameter |
|---|
TName extends string |
TSig extends string |
Parameters
| Parameter | Type |
|---|---|
name | TName |
signature | TSig |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: InferAxGen<TSig> }, TState>
Call Signature
n<TName>(name: TName, signature: AxSignature): AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L917
Type Parameters
| Type Parameter |
|---|
TName extends string |
Parameters
| Parameter | Type |
|---|---|
name | TName |
signature | AxSignature |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>
Call Signature
n<TName, TProgram>(name: TName, programClass: TProgram): AxFlow<IN, OUT, TNodes & { [K in string]: InstanceType<TProgram> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L926
Type Parameters
| Type Parameter |
|---|
TName extends string |
TProgram extends () => AxProgrammable<any, any> |
Parameters
| Parameter | Type |
|---|---|
name | TName |
programClass | TProgram |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: InstanceType<TProgram> }, TState>
Call Signature
n<TName, TProgram>(name: TName, programInstance: TProgram): AxFlow<IN, OUT, TNodes & { [K in string]: TProgram }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L933
Type Parameters
| Type Parameter |
|---|
TName extends string |
TProgram extends AxProgrammable<any, any, string> |
Parameters
| Parameter | Type |
|---|---|
name | TName |
programInstance | TProgram |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: TProgram }, TState>
namedProgramInstances()
namedProgramInstances(): AxNamedProgramInstance<IN, OUT>[];Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L489
Returns
AxNamedProgramInstance<IN, OUT>[]
Implementation of
AxFlowable.namedProgramInstances
namedPrograms()
namedPrograms(): object[];Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L484
Returns
object[]
node()
Call Signature
node<TName, TSig>(name: TName, signature: TSig): AxFlow<IN, OUT, TNodes & { [K in string]: InferAxGen<TSig> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L840
Type Parameters
| Type Parameter |
|---|
TName extends string |
TSig extends string |
Parameters
| Parameter | Type |
|---|---|
name | TName |
signature | TSig |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: InferAxGen<TSig> }, TState>
Call Signature
node<TName>(name: TName, signature: AxSignature): AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L845
Type Parameters
| Type Parameter |
|---|
TName extends string |
Parameters
| Parameter | Type |
|---|---|
name | TName |
signature | AxSignature |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>
Call Signature
node<TName, TProgram>(name: TName, programClass: TProgram): AxFlow<IN, OUT, TNodes & { [K in string]: InstanceType<TProgram> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L855
Type Parameters
| Type Parameter |
|---|
TName extends string |
TProgram extends () => AxProgrammable<any, any> |
Parameters
| Parameter | Type |
|---|---|
name | TName |
programClass | TProgram |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: InstanceType<TProgram> }, TState>
Call Signature
node<TName, TProgram>(name: TName, programInstance: TProgram): AxFlow<IN, OUT, TNodes & { [K in string]: TProgram }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L863
Type Parameters
| Type Parameter |
|---|
TName extends string |
TProgram extends AxProgrammable<any, any, string> |
Parameters
| Parameter | Type |
|---|---|
name | TName |
programInstance | TProgram |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: TProgram }, TState>
nodeExtended()
nodeExtended<TName>(
name: TName,
baseSignature:
| string
| AxSignature<Record<string, any>, Record<string, any>>,
extensions: object): AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1601
Type Parameters
| Type Parameter |
|---|
TName extends string |
Parameters
| Parameter | Type |
|---|---|
name | TName |
baseSignature | | string | AxSignature<Record<string, any>, Record<string, any>> |
extensions | { appendInputs?: object[]; appendOutputs?: object[]; prependInputs?: object[]; prependOutputs?: object[]; } |
extensions.appendInputs? | object[] |
extensions.appendOutputs? | object[] |
extensions.prependInputs? | object[] |
extensions.prependOutputs? | object[] |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>
nx()
nx<TName>(
name: TName,
baseSignature:
| string
| AxSignature<Record<string, any>, Record<string, any>>,
extensions: object): AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1636
Type Parameters
| Type Parameter |
|---|
TName extends string |
Parameters
| Parameter | Type |
|---|---|
name | TName |
baseSignature | | string | AxSignature<Record<string, any>, Record<string, any>> |
extensions | { appendInputs?: object[]; appendOutputs?: object[]; prependInputs?: object[]; prependOutputs?: object[]; } |
extensions.appendInputs? | object[] |
extensions.appendOutputs? | object[] |
extensions.prependInputs? | object[] |
extensions.prependOutputs? | object[] |
Returns
AxFlow<IN, OUT, TNodes & { [K in string]: AxGen<AxGenIn, AxGenOut> }, TState>
p()
p(branches: AxFlowTypedParallelBranch<TNodes, TState>[]): object;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1367
Parameters
| Parameter | Type |
|---|---|
branches | AxFlowTypedParallelBranch<TNodes, TState>[] |
Returns
object
| Name | Type |
|---|---|
merge() | (resultKey: TResultKey, mergeFunction: (…_results: unknown[]) => T) => |
parallel()
parallel(branches: AxFlowTypedParallelBranch<TNodes, TState>[]): object;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1270
Parameters
| Parameter | Type |
|---|---|
branches | AxFlowTypedParallelBranch<TNodes, TState>[] |
Returns
object
| Name | Type |
|---|---|
merge() | (resultKey: TResultKey, mergeFunction: (…_results: unknown[]) => T) => |
r()
r<TNewOut>(transform: (_state: TState) => TNewOut): AxFlow<IN, TNewOut, TNodes, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1036
Type Parameters
| Type Parameter |
|---|
TNewOut extends Record<string, unknown> |
Parameters
| Parameter | Type |
|---|---|
transform | (_state: TState) => TNewOut |
Returns
AxFlow<IN, TNewOut, TNodes, TState>
recordChatLog()
recordChatLog(_nodeName: string, entries: AxChatLogEntry[]): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L638
Parameters
| Parameter | Type |
|---|---|
_nodeName | string |
entries | AxChatLogEntry[] |
Returns
void
Implementation of
AxFlowNodeExecutionRecorder.recordChatLogrecordTraces()
recordTraces(nodeName: string, traces: AxProgramTrace<any, any>[]): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L633
Parameters
| Parameter | Type |
|---|---|
nodeName | string |
traces | AxProgramTrace<any, any>[] |
Returns
void
Implementation of
AxFlowNodeExecutionRecorder.recordTracesrecordUsage()
recordUsage(nodeName: string, usage: AxModelUsage & object[]): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L628
Parameters
| Parameter | Type |
|---|---|
nodeName | string |
usage | AxModelUsage & object[] |
Returns
void
Implementation of
AxFlowNodeExecutionRecorder.recordUsageresetChatLog()
resetChatLog(): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L579
Returns
void
resetTraces()
resetTraces(): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L575
Returns
void
resetUsage()
resetUsage(): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L563
Returns
void
Implementation of
returns()
returns<TNewOut>(transform: (_state: TState) => TNewOut): AxFlow<IN, TNewOut, TNodes, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1022
Type Parameters
| Type Parameter |
|---|
TNewOut extends Record<string, unknown> |
Parameters
| Parameter | Type |
|---|---|
transform | (_state: TState) => TNewOut |
Returns
AxFlow<IN, TNewOut, TNodes, TState>
setAllNodeInstructions()
setAllNodeInstructions(map: Readonly<Record<string, string>>): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L614
Parameters
| Parameter | Type |
|---|---|
map | Readonly<Record<string, string>> |
Returns
void
setDemos()
setDemos(demos: readonly AxProgramDemos<IN, OUT, keyof TNodes extends never ? string : `${string}.${string & keyof TNodes}`>[], options?: object): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L502
Parameters
| Parameter | Type |
|---|---|
demos | readonly AxProgramDemos<IN, OUT, keyof TNodes extends never ? string : `${string}.${string & keyof TNodes}`>[] |
options? | { modelConfig?: Record<string, unknown>; } |
options.modelConfig? | Record<string, unknown> |
Returns
void
Implementation of
setId()
setId(id: string): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L479
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void
Implementation of
setNodeInstruction()
setNodeInstruction(name: string, instruction: string): boolean;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L601
Parameters
| Parameter | Type |
|---|---|
name | string |
instruction | string |
Returns
boolean
stop()
stop(): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L228
Returns
void
streamingForward()
streamingForward<T>(
ai: T,
values: IN,
options?: Readonly<AxProgramStreamingForwardOptionsWithModels<T>>): AxGenStreamingOut<OUT>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L642
Type Parameters
| Type Parameter |
|---|
T extends Readonly<AxAIService<unknown, unknown, string>> |
Parameters
| Parameter | Type |
|---|---|
ai | T |
values | IN |
options? | Readonly<AxProgramStreamingForwardOptionsWithModels<T>> |
Returns
AxGenStreamingOut<OUT>
Implementation of
toFunction()
toFunction(): AxFunction;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L521
Returns
toString()
toString(options?: AxFlowMermaidRenderOptions): string;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1581
Renders this flow as a mermaid flowchart in the AxFlow mermaid dialect:
node contracts are emitted as %%ax nodeId: <signature> comment
directives (invisible to mermaid renderers) and control flow becomes
nodes and edges — branch decisions render as diamonds with labeled
out-edges, feedback loops as back-edges with max N caps.
String(flow) and template-literal interpolation yield the diagram —
mirroring AxSignature.toString() returning the signature string — and
flow(String(f)) round-trips exactly. Pass options for render control,
e.g. f.toString({ direction: 'LR' }) (like Number.toString(radix)).
Flows built with opaque closures (map/derive/returns/custom conditions)
render with placeholder nodes plus %% bind ... comments naming what
must be supplied via bindings to re-import the diagram. A while loop
renders with its body inlined once and a back-edge (the zero-iteration
exit is not drawable).
Parameters
| Parameter | Type |
|---|---|
options? | AxFlowMermaidRenderOptions |
Returns
string
w()
w(value: unknown): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1213
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
this
wh()
wh(condition: (_state: TState) => boolean, maxIterations: number): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1451
Parameters
| Parameter | Type | Default value |
|---|---|---|
condition | (_state: TState) => boolean | undefined |
maxIterations | number | 100 |
Returns
this
when()
when(value: unknown): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1202
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
this
while()
while(condition: (state: TState) => boolean, maxIterations: number): this;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1436
Parameters
| Parameter | Type | Default value |
|---|---|---|
condition | (state: TState) => boolean | undefined |
maxIterations | number | 100 |
Returns
this
create()
static create<IN, OUT, TNodes, TState>(options?: AxFlowOptions): AxFlow<IN, OUT, TNodes, TState>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L212
Type Parameters
| Type Parameter | Default type |
|---|---|
IN extends Record<string, any> | Record<string, unknown> |
OUT | object |
TNodes extends Record<string, AxProgrammable<any, any, string>> | Record<string, never> |
TState extends AxFlowState | IN |
Parameters
| Parameter | Type |
|---|---|
options? | AxFlowOptions |
Returns
AxFlow<IN, OUT, TNodes, TState>
patchLastStep()
static patchLastStep(target: AxFlow<any, any, any, any>, patch: object): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/flow/flow.ts#L1662
Internal
Patches the most recently added step. Used by the mermaid compiler
(flow(text)) to record decision fields, synthetic-returns markers, and
the declared reads/writes of generated projection steps (so signature
inference sees through them) on steps it just emitted through the public
builder.
Parameters
| Parameter | Type |
|---|---|
target | AxFlow<any, any, any, any> |
patch | { meta?: (existing: undefined | AxFlowStepMeta) => undefined | AxFlowStepMeta; reads?: readonly string[]; writes?: readonly string[]; } |
patch.meta? | (existing: undefined | AxFlowStepMeta) => undefined | AxFlowStepMeta |
patch.reads? | readonly string[] |
patch.writes? | readonly string[] |
Returns
void