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

AxSignatureBuilder

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/dsp/sig.ts#L35

Type Parameters

Type ParameterDefault type
_TInput extends Record<string, any>object
_TOutput extends Record<string, any>object

Constructors

Constructor

new AxSignatureBuilder<_TInput, _TOutput>(): AxSignatureBuilder<_TInput, _TOutput>;

Returns

AxSignatureBuilder<_TInput, _TOutput>

Methods

build()

build(): AxSignature<_TInput, _TOutput>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/dsp/sig.ts#L127

Build the final AxSignature instance

Returns

AxSignature<_TInput, _TOutput>


description()

description(description: string): AxSignatureBuilder<_TInput, _TOutput>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/dsp/sig.ts#L117

Set the description for the signature

Parameters

ParameterTypeDescription
descriptionstringDescription text

Returns

AxSignatureBuilder<_TInput, _TOutput>


input()

input<K, T>(
   name: K, 
   fieldInfo: T, 
prepend: boolean): AxSignatureBuilder<_TInput & Record<K, InferFluentType<T>>, _TOutput>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/dsp/sig.ts#L49

Add an input field to the signature

Type Parameters

Type Parameter
K extends string
T extends | AxFluentFieldType | AxFluentFieldInfo<any, any, any, any>

Parameters

ParameterTypeDefault valueDescription
nameKundefinedField name
fieldInfoTundefinedField type created with f.string(), f.number(), etc.
prependbooleanfalseIf true, adds field to the beginning of input fields

Returns

AxSignatureBuilder<_TInput & Record<K, InferFluentType<T>>, _TOutput>


output()

output<K, T>(
   name: K, 
   fieldInfo: T, 
prepend: boolean): AxSignatureBuilder<_TInput, _TOutput & Record<K, InferFluentType<T>>>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/dsp/sig.ts#L84

Add an output field to the signature

Type Parameters

Type Parameter
K extends string
T extends | AxFluentFieldType | AxFluentFieldInfo<any, any, any, any>

Parameters

ParameterTypeDefault valueDescription
nameKundefinedField name
fieldInfoTundefinedField type created with f.string(), f.number(), etc.
prependbooleanfalseIf true, adds field to the beginning of output fields

Returns

AxSignatureBuilder<_TInput, _TOutput & Record<K, InferFluentType<T>>>