You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dspy/teleprompt/gepa/gepa.py
+29-2Lines changed: 29 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,7 @@ def metric(
243
243
Note: When both instruction_proposer and reflection_lm are set, the instruction_proposer is called
244
244
in the reflection_lm context. However, reflection_lm is optional when using a custom instruction_proposer.
245
245
Custom instruction proposers can invoke their own LLMs if needed.
246
-
component_selector: Custom component selector implementing the ReflectionComponentSelector protocol,
246
+
component_selector: Custom component selector implementing the [ReflectionComponentSelector](https://github.com/gepa-ai/gepa/blob/main/src/gepa/proposer/reflective_mutation/base.py) protocol,
247
247
or a string specifying a built-in selector strategy. Controls which components (predictors) are selected
248
248
for optimization at each iteration. Defaults to 'round_robin' strategy which cycles through components
249
249
one at a time. Available string options: 'round_robin' (cycles through components sequentially),
@@ -274,7 +274,34 @@ def metric(
274
274
called with and without the pred_name. This flag (defaults to True) determines whether a warning is
275
275
raised if a mismatch in module-level and predictor-level score is detected.
276
276
seed: The random seed to use for reproducibility. Default is 0.
277
-
gepa_kwargs: (Optional) provide additional kwargs to be passed to [gepa.optimize](https://github.com/gepa-ai/gepa/blob/main/src/gepa/api.py) method
277
+
gepa_kwargs: (Optional) Additional keyword arguments to pass directly to [gepa.optimize](https://github.com/gepa-ai/gepa/blob/main/src/gepa/api.py).
278
+
Useful for accessing advanced GEPA features not directly exposed through DSPy's GEPA interface.
279
+
280
+
Available parameters:
281
+
- batch_sampler: Strategy for selecting training examples. Can be a [BatchSampler](https://github.com/gepa-ai/gepa/blob/main/src/gepa/strategies/batch_sampler.py) instance or a string
282
+
('epoch_shuffled'). Defaults to 'epoch_shuffled'. Only valid when reflection_minibatch_size is None.
283
+
- merge_val_overlap_floor: Minimum number of shared validation ids required between parents before
284
+
attempting a merge subsample. Only relevant when using `val_evaluation_policy` other than 'full_eval'.
285
+
Default is 5.
286
+
- stop_callbacks: Optional stopper(s) that return True when optimization should stop. Can be a single
287
+
[StopperProtocol](https://github.com/gepa-ai/gepa/blob/main/src/gepa/utils/stop_condition.py) or a list of StopperProtocol instances.
or custom stopping logic. Note: This overrides the default
293
+
max_metric_calls stopping condition.
294
+
- use_cloudpickle: Use cloudpickle instead of pickle for serialization. Can be helpful when the
295
+
serialized state contains dynamically generated DSPy signatures. Default is False.
296
+
- val_evaluation_policy: Strategy controlling which validation ids to score each iteration. Can be
297
+
'full_eval' (evaluate every id each time) or an [EvaluationPolicy](https://github.com/gepa-ai/gepa/blob/main/src/gepa/strategies/eval_policy.py) instance. Default is 'full_eval'.
298
+
- use_mlflow: If True, enables MLflow integration to log optimization progress.
299
+
MLflow can be used alongside Weights & Biases (WandB).
300
+
- mlflow_tracking_uri: The tracking URI to use for MLflow (when use_mlflow=True).
301
+
- mlflow_experiment_name: The experiment name to use for MLflow (when use_mlflow=True).
302
+
303
+
Note: Parameters already handled by DSPy's GEPA class will be overridden by the direct parameters
304
+
and should not be passed through gepa_kwargs.
278
305
279
306
Note:
280
307
Budget Configuration: Exactly one of `auto`, `max_full_evals`, or `max_metric_calls` must be provided.
0 commit comments