Skip to contents

Copy the optimized configuration (best parameters, demos, etc.) from a compiled module to a new or existing module. Useful for transferring optimization results to a fresh module instance.

Usage

apply_best_config(source, target = NULL, include = c("all", "params", "demos"))

Arguments

source

A compiled DSPrrr module with optimization results.

target

A DSPrrr module to apply the configuration to. If NULL, a copy of the source module is created.

include

Character vector specifying what to copy:

  • "params": Best parameter values (temperature, etc.)

  • "demos": Few-shot demonstration examples

  • "all": Both params and demos (default)

Value

The target module with the applied configuration (modified in place if target was provided, otherwise a new module).

Examples

if (FALSE) {
# Transfer optimization from one module to another
optimized <- mod$optimize_grid(data, metric, parameters)
new_mod <- module(signature, type = "predict")
apply_best_config(optimized, new_mod)

# Create a fresh copy with the optimized config
fresh <- apply_best_config(optimized, target = NULL)
}