Skip to content

Commit c865c4d

Browse files
ampagentIsaac Miller
andauthored
fix(gepa): allow an unset reflection cost budget
Amp-Thread-ID: https://ampcode.com/threads/T-019ffe40-c240-70bb-8cb2-db33146ed8e6 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
1 parent f84c206 commit c865c4d

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎dspy/teleprompt/gepa/gepa.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def __init__(
457457
self.component_selector = component_selector
458458
self.gepa_kwargs = gepa_kwargs or {}
459459

460-
if "max_reflection_cost" in self.gepa_kwargs:
460+
if self.gepa_kwargs.get("max_reflection_cost") is not None:
461461
raise ValueError("max_reflection_cost is not supported by dspy.GEPA yet.")
462462

463463
if "reflection_prompt_template" in self.gepa_kwargs:

‎tests/teleprompt/test_gepa.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,13 @@ def test_track_best_outputs_result_structure():
636636

637637

638638
def test_gepa_rejects_unsupported_reflection_cost_budget():
639+
dspy.GEPA(
640+
metric=simple_metric,
641+
max_metric_calls=1,
642+
reflection_lm=DummyLM([]),
643+
gepa_kwargs={"max_reflection_cost": None},
644+
)
645+
639646
with pytest.raises(ValueError, match="max_reflection_cost"):
640647
dspy.GEPA(
641648
metric=simple_metric,

0 commit comments

Comments
 (0)