DSPy: The framework for programming—not prompting—language models
Python
[MIPROv2] Fixed min to max in demo check
Michael Ryan1fdac764736c
diff --git a/dspy/propose/grounded_proposer.py b/dspy/propose/grounded_proposer.pyindex 993cacacc..d1d6192bb 100644--- a/dspy/propose/grounded_proposer.py+++ b/dspy/propose/grounded_proposer.py@@ -304,8 +304,8 @@ class GroundedProposer(Proposer):use_history = random.random() < 0.5self.use_instruct_history = use_historyif self.verbose: print(f"Use history T/F: {self.use_instruct_history}")-- num_demos = min(len(demo_candidates[0]) if demo_candidates else N, 1)++ num_demos = max(len(demo_candidates[0]) if demo_candidates else N, 1)if not demo_candidates:if self.verbose: print("No demo candidates provided. Running without task demos.")@@ -339,6 +339,7 @@ class GroundedProposer(Proposer):tip=selected_tip,),)+return proposed_instructionsdef propose_instruction_for_predictor(