nat.plugins.config_optimizer.prompts.base#
ABC for prompt optimizers.
Classes#
Interface that all prompt optimization strategies must implement. |
Module Contents#
- class BasePromptOptimizer#
Bases:
abc.ABCInterface that all prompt optimization strategies must implement.
Prompt optimizers run after parameter optimization (when both are enabled). The runtime passes
base_cfgas the already-tuned config from the numeric phase, plus optionaltrial_number_offsetandfrozen_params.Unlike
BaseParameterOptimizer, this interface returnsNone. Implementations persist the best prompts to disk (e.g.optimized_prompts.json) rather than updating the config in memory. The config is used as input for evaluation but is not mutated.- abstractmethod run(
- *,
- base_cfg: nat.data_models.config.Config,
- full_space: dict[str, nat.data_models.optimizable.SearchSpace],
- optimizer_config: nat.data_models.optimizer.OptimizerConfig,
- opt_run_config: nat.data_models.optimizer.OptimizerRunConfig,
- Async:
Run prompt optimization. Persists best prompts to disk; returns None.