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

AxOptimizerArgs

type AxOptimizerArgs = object;

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

Properties

acquisitionFunction?

optional acquisitionFunction: 
  | "expected_improvement"
  | "upper_confidence_bound"
  | "probability_improvement";

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


bayesianOptimization?

optional bayesianOptimization: boolean;

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


checkpointInterval?

optional checkpointInterval: number;

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


checkpointLoad?

optional checkpointLoad: AxCheckpointLoadFn;

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


checkpointSave?

optional checkpointSave: AxCheckpointSaveFn;

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


costTracker?

optional costTracker: AxCostTracker;

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


dataAwareProposer?

optional dataAwareProposer: boolean;

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


debugOptimizer?

optional debugOptimizer: boolean;

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


earlyStoppingTrials?

optional earlyStoppingTrials: number;

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


explorationWeight?

optional explorationWeight: number;

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


fewshotAwareProposer?

optional fewshotAwareProposer: boolean;

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


initTemperature?

optional initTemperature: number;

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


logger?

optional logger: AxLoggerFunction;

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


maxBootstrappedDemos?

optional maxBootstrappedDemos: number;

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


maxLabeledDemos?

optional maxLabeledDemos: number;

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


minibatch?

optional minibatch: boolean;

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


minibatchFullEvalSteps?

optional minibatchFullEvalSteps: number;

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


minibatchSize?

optional minibatchSize: number;

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


minImprovementThreshold?

optional minImprovementThreshold: number;

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


minSuccessRate?

optional minSuccessRate: number;

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


numCandidates?

optional numCandidates: number;

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


numTrials?

optional numTrials: number;

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


onEarlyStop()?

optional onEarlyStop: (reason: string, stats: Readonly<AxOptimizationStats>) => void;

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

Parameters

ParameterType
reasonstring
statsReadonly<AxOptimizationStats>

Returns

void


onProgress()?

optional onProgress: (progress: Readonly<AxOptimizationProgress>) => void;

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

Parameters

ParameterType
progressReadonly<AxOptimizationProgress>

Returns

void


optimizerEndpoint?

optional optimizerEndpoint: string;

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


optimizerLogger()?

optional optimizerLogger: (data: AxOptimizerLoggerData) => void;

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

Parameters

ParameterType
dataAxOptimizerLoggerData

Returns

void


optimizerRetries?

optional optimizerRetries: number;

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


optimizerTimeout?

optional optimizerTimeout: number;

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


optimizeTopP?

optional optimizeTopP: boolean;

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


programAwareProposer?

optional programAwareProposer: boolean;

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


resultPicker?

optional resultPicker: AxResultPickerFunction<any>;

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


resumeFromCheckpoint?

optional resumeFromCheckpoint: string;

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


sampleCount?

optional sampleCount: number;

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


seed?

optional seed: number;

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


studentAI

studentAI: AxAIService;

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


targetScore?

optional targetScore: number;

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


teacherAI?

optional teacherAI: AxAIService;

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


tipAwareProposer?

optional tipAwareProposer: boolean;

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


verbose?

optional verbose: boolean;

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


viewDataBatchSize?

optional viewDataBatchSize: number;

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