EvSys

gepa_prompt

GEPA-style prompt tuning - no weight updates, only the prompt evolves.

Two modes:

  1. If the gepa package is installed, delegate to gepa.optimize() with a reflection LM that proposes prompt mutations.
  2. 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) -> RunResult
paramctx
paramcfg
paramexamples
paramtask_lm
paramscore_fn
paramout
paramrng

Returns

evsys_sdk.protocols.RunResult
func_evaluate(prompt, examples, task_lm, score_fn) -> float
parampromptstr
paramexampleslist[Any]
paramtask_lm
paramscore_fn

Returns

float
func_default_score_fn(completion, expected) -> float

Trivial baseline: exact-match (1.0) or substring-match (0.5).

paramcompletionstr
paramexpectedAny

Returns

float
func_mutate_prompt(prompt, rng) -> str
parampromptstr
paramrngrandom.Random

Returns

str
func_run_with_gepa_lib(*, ctx, cfg, examples, task_lm, score_fn, out, rng) -> RunResult
paramctx
paramcfg
paramexamples
paramtask_lm
paramscore_fn
paramout
paramrng

Returns

evsys_sdk.protocols.RunResult