Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

fix: raise ValueError instead of UnboundLocalError when no valid program found (#9705)

Ricardo-M-Ld97ba839fd8d
diff --git a/dspy/teleprompt/utils.py b/dspy/teleprompt/utils.py
index 9fe6a1eae..3cdfb63d3 100644
--- a/dspy/teleprompt/utils.py
+++ b/dspy/teleprompt/utils.py
@@ -137,8 +137,7 @@ def get_program_with_highest_avg_score(param_score_dict, fully_evaled_param_comb
return program, mean, key, params
- # If no valid program is found, we return the last valid one that we found
- return program, mean, key, params
+ raise ValueError("No valid program found in param_score_dict")
def calculate_last_n_proposed_quality(