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

AxOptimizedProgramImpl

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

Type Parameters

Type ParameterDefault type
OUTany

Implements

Constructors

Constructor

new AxOptimizedProgramImpl<OUT>(config: object): AxOptimizedProgramImpl<OUT>;

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

Parameters

ParameterType
config{ bestScore: number; configurationHistory?: Record<string, unknown>[]; converged: boolean; demos?: AxProgramDemos<any, OUT>[]; examples?: AxExample[]; instruction?: string; modelConfig?: { [key: string]: unknown; frequencyPenalty?: number; maxTokens?: number; presencePenalty?: number; stop?: string | string[]; temperature?: number; topK?: number; topP?: number; }; optimizationTime: number; optimizerType: string; scoreHistory?: number[]; stats: AxOptimizationStats; totalRounds: number; }
config.bestScorenumber
config.configurationHistory?Record<string, unknown>[]
config.convergedboolean
config.demos?AxProgramDemos<any, OUT>[]
config.examples?AxExample[]
config.instruction?string
config.modelConfig?{ [key: string]: unknown; frequencyPenalty?: number; maxTokens?: number; presencePenalty?: number; stop?: string | string[]; temperature?: number; topK?: number; topP?: number; }
config.modelConfig.frequencyPenalty?number
config.modelConfig.maxTokens?number
config.modelConfig.presencePenalty?number
config.modelConfig.stop?string | string[]
config.modelConfig.temperature?number
config.modelConfig.topK?number
config.modelConfig.topP?number
config.optimizationTimenumber
config.optimizerTypestring
config.scoreHistory?number[]
config.statsAxOptimizationStats
config.totalRoundsnumber

Returns

AxOptimizedProgramImpl<OUT>

Properties

PropertyModifierType
bestScorereadonlynumber
configurationHistory?readonlyRecord<string, unknown>[]
convergedreadonlyboolean
demos?readonlyAxProgramDemos<any, OUT>[]
examples?readonlyAxExample[]
instruction?readonlystring
modelConfig?readonlyobject
modelConfig.frequencyPenalty?publicnumber
modelConfig.maxTokens?publicnumber
modelConfig.presencePenalty?publicnumber
modelConfig.stop?publicstring | string[]
modelConfig.temperature?publicnumber
modelConfig.topK?publicnumber
modelConfig.topP?publicnumber
optimizationTimereadonlynumber
optimizerTypereadonlystring
scoreHistory?readonlynumber[]
statsreadonlyAxOptimizationStats
totalRoundsreadonlynumber

Methods

applyTo()

applyTo<IN, T>(program: AxGen<IN, T>): void;

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

Type Parameters

Type Parameter
IN
T extends AxGenOut

Parameters

ParameterType
programAxGen<IN, T>

Returns

void

Implementation of

AxOptimizedProgram.applyTo