gepa_prompt
GEPA-style prompt tuning - no weight updates, only the prompt evolves.
Two modes:
- If the
gepapackage is installed, delegate togepa.optimize()with a reflection LM that proposes prompt mutations. - Otherwise fall back to a small built-in random-mutation hill-climber so the algorithm is still runnable for tests / smoke runs without deps.
Both modes evolve a single system_prompt against a set of
PromptExample rows scored by a verifier. The returned RunResult carries
best_prompt and best_score in metrics + writes the prompt as a
final_prompt artifact (prompts.json).
attributelogger= logging.getLogger(__name__)func_run_hill_climber(*, ctx, cfg, examples, task_lm, score_fn, out, rng) -> RunResultparamctxparamcfgparamexamplesparamtask_lmparamscore_fnparamoutparamrngReturns
evsys_sdk.protocols.RunResultfunc_evaluate(prompt, examples, task_lm, score_fn) -> floatparampromptstrparamexampleslist[Any]paramtask_lmparamscore_fnReturns
floatfunc_default_score_fn(completion, expected) -> floatTrivial baseline: exact-match (1.0) or substring-match (0.5).
paramcompletionstrparamexpectedAnyReturns
floatfunc_mutate_prompt(prompt, rng) -> strparampromptstrparamrngrandom.RandomReturns
strfunc_run_with_gepa_lib(*, ctx, cfg, examples, task_lm, score_fn, out, rng) -> RunResultparamctxparamcfgparamexamplesparamtask_lmparamscore_fnparamoutparamrngReturns
evsys_sdk.protocols.RunResult