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

AxSynth

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/dsp/synth.ts#L118

AxSynth generates synthetic training data.

Example

const synth = new AxSynth(signature, {
  teacher: ai('openai', { model: 'gpt-4o' }),
  domain: 'customer support',
  edgeCases: ['angry customers', 'vague requests'],
});

const { examples } = await synth.generate(100);

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Constructors

Constructor

new AxSynth<IN, OUT>(signature: AxSignature<IN, OUT>, options: AxSynthOptions): AxSynth<IN, OUT>;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/dsp/synth.ts#L125

Parameters

ParameterType
signatureAxSignature<IN, OUT>
optionsAxSynthOptions

Returns

AxSynth<IN, OUT>

Methods

generate()

generate(count: number, options?: object): Promise<AxSynthResult>;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/dsp/synth.ts#L140

Generate synthetic examples.

Parameters

ParameterType
countnumber
options?{ batchSize?: number; }
options.batchSize?number

Returns

Promise<AxSynthResult>


getSignature()

getSignature(): AxSignature<IN, OUT>;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/dsp/synth.ts#L326

Get the signature being used.

Returns

AxSignature<IN, OUT>


getTeacher()

getTeacher(): AxAIService;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/dsp/synth.ts#L333

Get the teacher AI service.

Returns

AxAIService