Package-level declarations

Types

Link copied to clipboard

Converts an evaluated rollout into the continuous score and textual module feedback GEPA needs.

Link copied to clipboard
data class GEPAFeedbackResult(val score: Double, val moduleFeedbacks: Map<String, GEPAModuleFeedbackResult?>)

Feedback produced for one GEPA rollout.

Link copied to clipboard
data class GEPAMergeConfig(val enabled: Boolean = false, val maxMergeInvocations: Int = 5, val maxMergeAttempts: Int = 10, val maxFindSharedAncestorAttempts: Int = 10, val valSetSubsampleSize: Int = 5)

Runtime controls for GEPA's optional merge step.

Link copied to clipboard
data class GEPAModuleFeedbackResult(val input: String, val output: String, val feedbackText: String)

Textual feedback for one optimizable module on one GEPA rollout.

Link copied to clipboard

Strategy for choosing which optimizable modules GEPA updates on each feedback batch.

Link copied to clipboard
class GEPAOptimizer<Input, Output, InputLabel>(gepaFeedback: GEPAFeedback<Input, Output, InputLabel>, feedbackValSplitFn: (TrainSet<Input, InputLabel>) -> GEPATrainSetSplit<Input, InputLabel>, reflectionModel: LLModel, val storagePath: ResilientPath, numRollouts: Int, feedbackBatchSize: Int = 3, skipPerfectFeedbackBatches: Boolean = true, perfectScoreThreshold: Double = 1.0, randomSeed: Long = 42, moduleSelectionStrategy: GEPAModuleSelectionStrategy = GEPAModuleSelectionStrategy.ROUND_ROBIN, useStructuredOutput: Boolean = false, requireThinkingFieldInOutput: Boolean = false, mergeConfig: GEPAMergeConfig = GEPAMergeConfig(), failureScore: Double = 0.0, feedbackFailureRateThreshold: Double = 1.0, validationFailureRateThreshold: Double = 0.9, seedValidationFailureRateThreshold: Double = 0.0, abortOnFailureRateExceeded: Boolean = true) : AgentOptimizer<Input, Output, InputLabel>

GEPA optimizer, based on "GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning" (https://arxiv.org/abs/2507.19457).

Link copied to clipboard
data class GEPATrainSetSplit<Input, InputLabel>(val feedbackSet: TrainSet<Input, InputLabel>, val validationSet: TrainSet<Input, InputLabel>)

The two sets GEPA trains on, split off a training set.

Functions

Link copied to clipboard
fun <Input, Output, InputLabel> singleModuleGepaFeedback(moduleName: String, formatInput: (Input) -> String = { it.toString() }, formatOutput: (Output) -> String = { it.toString() }, feedback: (input: Input, output: Output, gold: InputLabel, fullTrace: Prompt?, subgraphTraces: Map<String, List<Demonstration>>) -> Pair<Double, String>): GEPAFeedback<Input, Output, InputLabel>

Convenience helper for building a feedback function for a single explicit module.

Link copied to clipboard
fun <Input, Output, InputLabel> strategyOnlyGepaFeedback(formatInput: (Input) -> String = { it.toString() }, formatOutput: (Output) -> String = { it.toString() }, feedback: (input: Input, output: Output, gold: InputLabel, fullTrace: Prompt?, subgraphTraces: Map<String, List<Demonstration>>) -> Pair<Double, String>): GEPAFeedback<Input, Output, InputLabel>

Convenience helper for building a feedback function for agents that only optimize the strategy instruction.