AxProgram
Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L22
Extended by
Type Parameters
| Type Parameter | Default type |
|---|---|
IN | any |
OUT | any |
Implements
Constructors
Constructor
new AxProgram<IN, OUT>(signature:
| undefined
| string
| Readonly<AxSignature<Record<string, any>, Record<string, any>>>
| Readonly<AxSignatureConfig>, options?: Readonly<AxProgramOptions>): AxProgram<IN, OUT>;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L41
Parameters
| Parameter | Type |
|---|---|
signature | | undefined | string | Readonly<AxSignature<Record<string, any>, Record<string, any>>> | Readonly<AxSignatureConfig> |
options? | Readonly<AxProgramOptions> |
Returns
AxProgram<IN, OUT>
Methods
applyOptimization()
applyOptimization(optimizedProgram: AxOptimizedProgram<OUT>): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L370
Parameters
| Parameter | Type |
|---|---|
optimizedProgram | AxOptimizedProgram<OUT> |
Returns
void
Implementation of
applyOptimizedComponents()
applyOptimizedComponents(updates: Readonly<Record<string, string>>): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L444
Broadcast component updates across this subtree. Each node filters keys
belonging to itself and dispatches via applyLocalOptimizedComponents.
Parameters
| Parameter | Type |
|---|---|
updates | Readonly<Record<string, string>> |
Returns
void
Implementation of
AxTunable.applyOptimizedComponents
getChatLog()
getChatLog(): readonly AxChatLogEntry[];Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L178
Returns
readonly AxChatLogEntry[]
Implementation of
getId()
getId(): string;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L96
Returns
string
Implementation of
getOptimizableComponents()
getOptimizableComponents(): readonly AxOptimizableComponent[];Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L393
Walks the program tree and emits one AxOptimizableComponent per
string-valued artifact reachable from this node. Subclasses override
localOptimizableComponents() to add their own; tree traversal is
handled here so callers never need to recurse.
Returns
readonly AxOptimizableComponent[]
Implementation of
AxTunable.getOptimizableComponents
getSignature()
getSignature(): AxSignature;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L69
Returns
getTraces()
getTraces(): AxProgramTrace<IN, OUT>[];Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L151
Returns
AxProgramTrace<IN, OUT>[]
Implementation of
getUsage()
getUsage(): AxModelUsage & object[];Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L165
Returns
AxModelUsage & object[]
Implementation of
namedProgramInstances()
namedProgramInstances(): AxNamedProgramInstance<IN, OUT>[];Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L337
Returns
AxNamedProgramInstance<IN, OUT>[]
Implementation of
AxTunable.namedProgramInstances
namedPrograms()
namedPrograms(): object[];Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L306
Returns all programs in the hierarchy with their IDs and signatures.
Use this to discover the IDs needed for setDemos().
Equivalent to DSPy’s named_parameters().
Example
agent.setId('qa');
console.log(agent.namedPrograms());
// [
// { id: 'qa.actor', signature: '... -> javascriptCode' },
// { id: 'qa.responder', signature: '... -> answer' },
// ]
Returns
object[]
register()
register(prog: Readonly<AxTunable<IN, OUT> & AxUsable>, name?: string): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L100
Parameters
| Parameter | Type |
|---|---|
prog | Readonly<AxTunable<IN, OUT> & AxUsable> |
name? | string |
Returns
void
resetUsage()
resetUsage(): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L202
Returns
void
Implementation of
setDemos()
setDemos(demos: readonly AxProgramDemos<IN, OUT>[], options?: object): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L211
Parameters
| Parameter | Type |
|---|---|
demos | readonly AxProgramDemos<IN, OUT>[] |
options? | { modelConfig?: Record<string, unknown>; } |
options.modelConfig? | Record<string, unknown> |
Returns
void
Implementation of
setDescription()
setDescription(description: string): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L87
Parameters
| Parameter | Type |
|---|---|
description | string |
Returns
void
setExamples()
setExamples(examples: Readonly<AxProgramExamples<IN, OUT>>, options?: Readonly<AxSetExamplesOptions>): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L118
Parameters
| Parameter | Type |
|---|---|
examples | Readonly<AxProgramExamples<IN, OUT>> |
options? | Readonly<AxSetExamplesOptions> |
Returns
void
setId()
setId(id: string): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L111
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void
Implementation of
setSignature()
setSignature(signature:
| string
| Readonly<AxSignature<Record<string, any>, Record<string, any>>>
| Readonly<AxSignatureConfig>): void;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/dsp/program.ts#L73
Parameters
| Parameter | Type |
|---|---|
signature | | string | Readonly<AxSignature<Record<string, any>, Record<string, any>>> | Readonly<AxSignatureConfig> |
Returns
void