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

AxGEPAFlow

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizers/gepaFlow.ts#L25

Flow-aware GEPA (system-level reflective evolution with module selection + system-aware merge)

Extends

Constructors

Constructor

new AxGEPAFlow(args: Readonly<AxOptimizerArgs>): AxGEPAFlow;

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizers/gepaFlow.ts#L53

Parameters

ParameterType
argsReadonly<AxOptimizerArgs>

Returns

AxGEPAFlow

Overrides

AxBaseOptimizer.constructor

Methods

compile()

compile<IN, OUT>(
   program: Readonly<any>, 
   examples: readonly AxTypedExample<IN>[], 
   metricFn: AxMetricFn, 
options?: AxCompileOptions): Promise<AxParetoResult<OUT>>;

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizers/gepaFlow.ts#L129

Multi-objective GEPA-Flow: system-level reflective evolution with Pareto frontier

Type Parameters

Type Parameter
IN
OUT extends AxGenOut

Parameters

ParameterType
programReadonly<any>
examplesreadonly AxTypedExample<IN>[]
metricFnAxMetricFn
options?AxCompileOptions

Returns

Promise<AxParetoResult<OUT>>

Overrides

AxBaseOptimizer.compile


compilePareto()

compilePareto<IN, OUT>(
   program: Readonly<AxGen<IN, OUT>>, 
   examples: readonly AxTypedExample<IN>[], 
   metricFn: AxMultiMetricFn, 
options?: AxCompileOptions): Promise<AxParetoResult<OUT>>;

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizer.ts#L1561

Multi-objective optimization using Pareto frontier Default implementation that leverages the single-objective compile method

Type Parameters

Type Parameter
IN
OUT extends AxGenOut

Parameters

ParameterTypeDescription
programReadonly<AxGen<IN, OUT>>The program to optimize
examplesreadonly AxTypedExample<IN>[]Training examples
metricFnAxMultiMetricFnMulti-objective metric function that returns multiple scores
options?AxCompileOptionsOptional configuration options

Returns

Promise<AxParetoResult<OUT>>

Pareto optimization result with frontier of non-dominated solutions

Inherited from

AxBaseOptimizer.compilePareto


compileStream()

compileStream<IN, OUT>(
   program: Readonly<AxGen<IN, OUT>>, 
   examples: readonly AxTypedExample<IN>[], 
   metricFn: AxMetricFn, 
options?: AxCompileOptions): AsyncIterableIterator<AxOptimizationProgress>;

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizer.ts#L1448

Optimize a program with real-time streaming updates

Type Parameters

Type Parameter
IN
OUT extends AxGenOut

Parameters

ParameterTypeDescription
programReadonly<AxGen<IN, OUT>>The program to optimize
examplesreadonly AxTypedExample<IN>[]Training examples
metricFnAxMetricFnEvaluation metric function
options?AxCompileOptionsOptional configuration options

Returns

AsyncIterableIterator<AxOptimizationProgress>

Async iterator yielding optimization progress

Inherited from

AxBaseOptimizer.compileStream


configureAuto()

configureAuto(level: "light" | "medium" | "heavy"): void;

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizers/gepaFlow.ts#L106

Parameters

ParameterType
level"light" | "medium" | "heavy"

Returns

void


getStats()

getStats(): AxOptimizationStats;

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizer.ts#L2494

Get current optimization statistics

Returns

AxOptimizationStats

Current optimization statistics

Inherited from

AxBaseOptimizer.getStats


reset()

reset(): void;

Defined in: https://github.com/ax-llm/ax/blob/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/optimizers/gepaFlow.ts#L91

Reset optimizer state for reuse with different programs

Returns

void

Overrides

AxBaseOptimizer.reset