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

AxFlowSubContext

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

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/types.ts#L113

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


executeSteps()

executeSteps<TAI>(initialState: AxFlowState, context: Readonly<{
  mainAi: TAI;
  mainOptions?: AxProgramForwardOptions<NonNullable<ReturnType<TAI["getModelList"]>>[number]["key"]>;
}>): Promise<AxFlowState>;

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

Type Parameters

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

Parameters

ParameterType
initialStateAxFlowState
contextReadonly<{ mainAi: TAI; mainOptions?: AxProgramForwardOptions<NonNullable<ReturnType<TAI["getModelList"]>>[number]["key"]>; }>

Returns

Promise<AxFlowState>


map()

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

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

Parameters

ParameterType
transform(state: AxFlowState) => AxFlowState

Returns

this