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/be56d0cb4027af0a3a23d397cd01a57261e362d4/src/ax/dsp/common_types.ts#L110

Properties

acquisitionFunction?

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

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


bayesianOptimization?

optional bayesianOptimization: boolean;

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


checkpointInterval?

optional checkpointInterval: number;

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


checkpointLoad?

optional checkpointLoad: AxCheckpointLoadFn;

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


checkpointSave?

optional checkpointSave: AxCheckpointSaveFn;

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


costTracker?

optional costTracker: AxCostTracker;

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


dataAwareProposer?

optional dataAwareProposer: boolean;

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


debugOptimizer?

optional debugOptimizer: boolean;

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


earlyStoppingTrials?

optional earlyStoppingTrials: number;

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


explorationWeight?

optional explorationWeight: number;

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


fewshotAwareProposer?

optional fewshotAwareProposer: boolean;

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


initTemperature?

optional initTemperature: number;

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


logger?

optional logger: AxLoggerFunction;

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


maxBootstrappedDemos?

optional maxBootstrappedDemos: number;

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


maxLabeledDemos?

optional maxLabeledDemos: number;

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


minibatch?

optional minibatch: boolean;

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


minibatchFullEvalSteps?

optional minibatchFullEvalSteps: number;

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


minibatchSize?

optional minibatchSize: number;

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


minImprovementThreshold?

optional minImprovementThreshold: number;

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


minSuccessRate?

optional minSuccessRate: number;

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


numCandidates?

optional numCandidates: number;

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


numTrials?

optional numTrials: number;

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


onEarlyStop()?

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

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

Parameters

ParameterType
reasonstring
statsReadonly<AxOptimizationStats>

Returns

void


onProgress()?

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

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

Parameters

ParameterType
progressReadonly<AxOptimizationProgress>

Returns

void


optimizerEndpoint?

optional optimizerEndpoint: string;

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


optimizerLogger()?

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

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

Parameters

ParameterType
dataAxOptimizerLoggerData

Returns

void


optimizerRetries?

optional optimizerRetries: number;

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


optimizerTimeout?

optional optimizerTimeout: number;

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


optimizeTopP?

optional optimizeTopP: boolean;

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


programAwareProposer?

optional programAwareProposer: boolean;

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


resultPicker?

optional resultPicker: AxResultPickerFunction<any>;

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


resumeFromCheckpoint?

optional resumeFromCheckpoint: string;

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


sampleCount?

optional sampleCount: number;

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


seed?

optional seed: number;

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


studentAI

studentAI: AxAIService;

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


targetScore?

optional targetScore: number;

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


teacherAI?

optional teacherAI: AxAIService;

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


tipAwareProposer?

optional tipAwareProposer: boolean;

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


verbose?

optional verbose: boolean;

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


viewDataBatchSize?

optional viewDataBatchSize: number;

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