Skip to content

RefinerConfig

gepa.optimize_anything.RefinerConfig(refiner_lm: LanguageModel | str | None = None, max_refinements: int = 1) dataclass

Automatic per-evaluation candidate refinement via LLM.

When enabled, after each evaluation GEPA calls an LLM to propose a refined version of the candidate based on the evaluation feedback. The refined candidate is re-evaluated, and the better of (original, refined) is kept.

A refiner_prompt parameter is auto-injected into seed candidates and co-evolved alongside the other parameters. All non-refiner params are refined together as a JSON dict.

Set config.refiner = None to disable refinement.

Attributes

refiner_lm: LanguageModel | str | None = None class-attribute instance-attribute

max_refinements: int = 1 class-attribute instance-attribute

Functions