Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

Oops, sorry that would have removed boolean metrics without a metric_threshold set, fixed now

Connor Shorten89ceaab1e89a
diff --git a/dspy/teleprompt/bootstrap.py b/dspy/teleprompt/bootstrap.py
index 92e0e7be7..ba4e649a3 100644
--- a/dspy/teleprompt/bootstrap.py
+++ b/dspy/teleprompt/bootstrap.py
@@ -149,8 +149,12 @@ class BootstrapFewShot(Teleprompter):
for name, predictor in teacher.named_predictors():
predictor.demos = predictor_cache[name]
- if self.metric and self.metric_threshold:
- success = self.metric(example, prediction, trace) > self.metric_threshold
+ if self.metric:
+ metric_val = self.metric(example, prediction, trace)
+ if self.metric_threshold:
+ success = metric_val > self.metric_threshold
+ else:
+ success = metric_val
else:
success = True
# print(success, example, prediction)