Documentation

Build LLM-powered agents
with production-ready TypeScript

DSPy for TypeScript. Working with LLMs is complex—they don't always do what you want. DSPy makes it easier to build amazing things with LLMs. Just define your inputs and outputs (signature) and an efficient prompt is auto-generated and used. Connect together various signatures to build complex systems and workflows using LLMs.

15+ LLM Providers
End-to-end Streaming
Auto Prompt Tuning

AxFlowSubContextImpl

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/flow/subContext.ts#L27

Implementation of the sub-context for parallel execution

Implements

Constructors

Constructor

new AxFlowSubContextImpl(nodeGenerators: Map<string, AxForwardable<AxGenIn, AxGenOut, string> & AxTunable<AxGenIn, AxGenOut> & AxUsable>): AxFlowSubContextImpl;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/flow/subContext.ts#L30

Parameters

ParameterType
nodeGeneratorsMap<string, AxForwardable<AxGenIn, AxGenOut, string> & AxTunable<AxGenIn, AxGenOut> & AxUsable>

Returns

AxFlowSubContextImpl

Methods

execute()

execute<TAI>(
   nodeName: string, 
   mapping: (state: AxFlowState) => Record<string, AxFieldValue>, 
   dynamicContext?: AxFlowDynamicContext<TAI>): this;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/flow/subContext.ts#L39

Type Parameters

Type Parameter
TAI extends Readonly<AxAIService<unknown, unknown, string>>

Parameters

ParameterType
nodeNamestring
mapping(state: AxFlowState) => Record<string, AxFieldValue>
dynamicContext?AxFlowDynamicContext<TAI>

Returns

this

Implementation of

AxFlowSubContext.execute


executeSteps()

executeSteps(initialState: AxFlowState, context: Readonly<{
  mainAi: AxAIService;
  mainOptions?: AxProgramForwardOptions<string>;
}>): Promise<AxFlowState>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/flow/subContext.ts#L90

Parameters

ParameterType
initialStateAxFlowState
contextReadonly<{ mainAi: AxAIService; mainOptions?: AxProgramForwardOptions<string>; }>

Returns

Promise<AxFlowState>

Implementation of

AxFlowSubContext.executeSteps


map()

map(transform: (state: AxFlowState) => AxFlowState): this;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/flow/subContext.ts#L85

Parameters

ParameterType
transform(state: AxFlowState) => AxFlowState

Returns

this

Implementation of

AxFlowSubContext.map