Fix dspy.GEPA(max_steps=...) crash on DSPy 3.2+#91
Open
0xDecay wants to merge 1 commit into
Open
Conversation
DSPy 3.2 removed the max_steps kwarg in favor of max_metric_calls. Since this repo pins dspy>=3.0.0 with no upper bound, fresh installs pull dspy 3.2.1 and crash on the first GEPA call. Tested on DSPy 3.2.1 + Python 3.12 with Anthropic models; optimization runs end-to-end through the MIPROv2 fallback path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
evolve_skill.py:157callsdspy.GEPA(metric=..., max_steps=iterations). DSPy 3.2 removedmax_stepsin favor ofmax_metric_calls(total metric evaluations across optimization).Since
pyproject.tomlpinsdspy>=3.0.0with no upper bound, a freshpip install -e .on a clean venv pullsdspy==3.2.1and the first GEPA call crashes:The downstream MIPROv2 fallback then crashes too (missing
optuna), so the whole pipeline fails.Fix
Swap
max_steps=iterationsformax_metric_calls=max(iterations * 10, 30):--iterations 1and--iterations 2don't trivialize the optimizationTesting
Reproduced and verified on:
anthropic/claude-sonnet-4-6(optimizer) +anthropic/claude-haiku-4-5(eval)--iterations 3 --eval-source syntheticagainst a real SKILL.mdOptimization now runs to completion (148s, 11 candidates scored, best 68.75) and constraint validation fires correctly.
Notes
inspect.signaturedetection, but this single-line swap is the minimum change to unblock the 3.2 path. Happy to expand to a version-aware shim if you'd prefer.dspy.experimental— the existing MIPROv2 fallback handles this gracefully (onceoptunais installed). May be worth addingoptunaas an explicit dep.