AxOptimizer
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L910
Methods
cancel()?
optional cancel(): Promise<void>;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L966
Cancel ongoing optimization gracefully
Returns
Promise
<void
>
Promise that resolves when cancellation is complete
compile()
compile<IN, OUT>(
program: Readonly<AxGen<IN, OUT>>,
examples: readonly AxTypedExample<IN>[],
metricFn: AxMetricFn,
options?: AxCompileOptions): Promise<AxOptimizerResult<OUT>>;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L919
Optimize a program using the provided metric function
Type Parameters
Type Parameter |
---|
IN |
OUT extends AxGenOut |
Parameters
Parameter | Type | Description |
---|---|---|
program | Readonly <AxGen <IN , OUT >> | The program to optimize |
examples | readonly AxTypedExample <IN >[] | Training examples (typed based on the program) - will be auto-split into train/validation |
metricFn | AxMetricFn | Evaluation metric function to assess program performance |
options? | AxCompileOptions | Optional configuration options |
Returns
Promise
<AxOptimizerResult
<OUT
>>
Optimization result containing demos, stats, and configuration
compilePareto()?
optional compilePareto<IN, OUT>(
program: Readonly<AxGen<IN, OUT>>,
examples: readonly AxTypedExample<IN>[],
metricFn: AxMultiMetricFn,
options?: AxCompileOptions): Promise<AxParetoResult<OUT>>;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L949
Multi-objective optimization using Pareto frontier
Type Parameters
Type Parameter |
---|
IN |
OUT extends AxGenOut |
Parameters
Parameter | Type | Description |
---|---|---|
program | Readonly <AxGen <IN , OUT >> | The program to optimize |
examples | readonly AxTypedExample <IN >[] | Training examples |
metricFn | AxMultiMetricFn | Multi-objective metric function |
options? | AxCompileOptions | Optional configuration options |
Returns
Promise
<AxParetoResult
<OUT
>>
Pareto optimization result
compileStream()?
optional compileStream<IN, OUT>(
program: Readonly<AxGen<IN, OUT>>,
examples: readonly AxTypedExample<IN>[],
metricFn: AxMetricFn,
options?: AxCompileOptions): AsyncIterableIterator<AxOptimizationProgress>;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L934
Optimize a program with real-time streaming updates
Type Parameters
Type Parameter |
---|
IN |
OUT extends AxGenOut |
Parameters
Parameter | Type | Description |
---|---|---|
program | Readonly <AxGen <IN , OUT >> | The program to optimize |
examples | readonly AxTypedExample <IN >[] | Training examples |
metricFn | AxMetricFn | Evaluation metric function |
options? | AxCompileOptions | Optional configuration options |
Returns
AsyncIterableIterator
<AxOptimizationProgress
>
Async iterator yielding optimization progress
getConfiguration()?
optional getConfiguration(): Record<string, unknown>;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L977
Get optimizer-specific configuration
Returns
Record
<string
, unknown
>
Current optimizer configuration
getStats()
getStats(): AxOptimizationStats;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L960
Get current optimization statistics
Returns
Current optimization statistics
reset()?
optional reset(): void;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L971
Reset optimizer state for reuse with different programs
Returns
void
updateConfiguration()?
optional updateConfiguration(config: Readonly<Record<string, unknown>>): void;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L983
Update optimizer configuration
Parameters
Parameter | Type | Description |
---|---|---|
config | Readonly <Record <string , unknown >> | New configuration to merge with existing |
Returns
void
validateProgram()?
optional validateProgram<IN, OUT>(program: Readonly<AxGen<IN, OUT>>): object;
Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/dsp/optimizer.ts#L990
Validate that the optimizer can handle the given program
Type Parameters
Type Parameter |
---|
IN |
OUT extends AxGenOut |
Parameters
Parameter | Type | Description |
---|---|---|
program | Readonly <AxGen <IN , OUT >> | Program to validate |
Returns
object
Validation result with any issues found
Name | Type |
---|---|
issues | string [] |
isValid | boolean |
suggestions | string [] |