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

AxProgram

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L18

Extended by

Type Parameters

Type Parameter
IN
OUT

Implements

Constructors

Constructor

new AxProgram<IN, OUT>(signature: 
  | undefined
  | Readonly<
  | string
  | AxSignature<Record<string, any>, Record<string, any>>
| AxSignatureConfig>, options?: Readonly<AxProgramOptions>): AxProgram<IN, OUT>;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L32

Parameters

ParameterType
signature| undefined | Readonly< | string | AxSignature<Record<string, any>, Record<string, any>> | AxSignatureConfig>
options?Readonly<AxProgramOptions>

Returns

AxProgram<IN, OUT>

Methods

applyOptimization()

applyOptimization(optimizedProgram: AxOptimizedProgram<OUT>): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L213

Apply optimized configuration to this program

Parameters

ParameterTypeDescription
optimizedProgramAxOptimizedProgram<OUT>The optimized program configuration to apply

Returns

void

Implementation of

AxTunable.applyOptimization


getSignature()

getSignature(): AxSignature;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L56

Returns

AxSignature


getTraces()

getTraces(): AxProgramTrace<IN, OUT>[];

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L154

Returns

AxProgramTrace<IN, OUT>[]

Implementation of

AxTunable.getTraces


getUsage()

getUsage(): AxModelUsage & object[];

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L168

Returns

AxModelUsage & object[]

Implementation of

AxUsable.getUsage


register()

register(prog: Readonly<AxTunable<IN, OUT> & AxUsable>): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L84

Parameters

ParameterType
progReadonly<AxTunable<IN, OUT> & AxUsable>

Returns

void


resetUsage()

resetUsage(): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L178

Returns

void

Implementation of

AxUsable.resetUsage


setDemos()

setDemos(demos: readonly AxProgramDemos<IN, OUT>[]): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L185

Parameters

ParameterType
demosreadonly AxProgramDemos<IN, OUT>[]

Returns

void

Implementation of

AxTunable.setDemos


setDescription()

setDescription(description: string): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L74

Parameters

ParameterType
descriptionstring

Returns

void


setExamples()

setExamples(examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L104

Parameters

ParameterType
examplesReadonly<AxProgramExamples<IN, OUT>>
options?Readonly<AxSetExamplesOptions>

Returns

void

Implementation of

AxTunable.setExamples


setId()

setId(id: string): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L91

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxTunable.setId


setParentId()

setParentId(parentId: string): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L98

Parameters

ParameterType
parentIdstring

Returns

void

Implementation of

AxTunable.setParentId


setSignature()

setSignature(signature: 
  | undefined
  | Readonly<
  | string
  | AxSignature<Record<string, any>, Record<string, any>>
  | AxSignatureConfig>): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/program.ts#L60

Parameters

ParameterType
signature| undefined | Readonly< | string | AxSignature<Record<string, any>, Record<string, any>> | AxSignatureConfig>

Returns

void