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

AxAgentic

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/prompts/agent.ts#L40

Interface for agents that can be used as child agents. Provides methods to get the agent’s function definition and features.

Extends

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Methods

applyOptimization()

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

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L302

Parameters

ParameterType
optimizedProgramAxOptimizedProgram<OUT>

Returns

void

Inherited from

AxProgrammable.applyOptimization


forward()

forward(
   ai: Readonly<AxAIService>, 
   values: IN | AxMessage<IN>[], 
options?: Readonly<AxProgramForwardOptions<string>>): Promise<OUT>;

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L281

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN | AxMessage<IN>[]
options?Readonly<AxProgramForwardOptions<string>>

Returns

Promise<OUT>

Inherited from

AxProgrammable.forward


getFunction()

getFunction(): AxFunction;

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/prompts/agent.ts#L42

Returns

AxFunction


getId()

getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L295

Returns

string

Inherited from

AxProgrammable.getId


getSignature()

getSignature(): AxSignature;

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L314

Returns

AxSignature

Inherited from

AxProgrammable.getSignature


getTraces()

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

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L297

Returns

AxProgramTrace<IN, OUT>[]

Inherited from

AxProgrammable.getTraces


getUsage()

getUsage(): AxModelUsage & object[];

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L306

Returns

AxModelUsage & object[]

Inherited from

AxProgrammable.getUsage


resetUsage()

resetUsage(): void;

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L307

Returns

void

Inherited from

AxProgrammable.resetUsage


setDemos()

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

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L298

Parameters

ParameterType
demosreadonly AxProgramDemos<IN, OUT, string>[]
options?{ modelConfig?: Record<string, unknown>; }
options.modelConfig?Record<string, unknown>

Returns

void

Inherited from

AxProgrammable.setDemos


setId()

setId(id: string): void;

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L296

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxProgrammable.setId


streamingForward()

streamingForward(
   ai: Readonly<AxAIService>, 
   values: IN | AxMessage<IN>[], 
options?: Readonly<AxProgramStreamingForwardOptions<string>>): AxGenStreamingOut<OUT>;

Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/types.ts#L287

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN | AxMessage<IN>[]
options?Readonly<AxProgramStreamingForwardOptions<string>>

Returns

AxGenStreamingOut<OUT>

Inherited from

AxProgrammable.streamingForward