Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

fix(optimizer): Undo fix for issue #824

Dhar Rawal9d582d9e82f7
diff --git a/dspy/teleprompt/random_search.py b/dspy/teleprompt/random_search.py
index 376064901..2b9c4e592 100644
--- a/dspy/teleprompt/random_search.py
+++ b/dspy/teleprompt/random_search.py
@@ -28,7 +28,7 @@ class BootstrapFewShotWithRandomSearch(Teleprompter):
def __init__(
self,
metric,
- teacher_settings=None,
+ teacher_settings={},
max_bootstrapped_demos=4,
max_labeled_demos=16,
max_rounds=1,
@@ -39,12 +39,7 @@ class BootstrapFewShotWithRandomSearch(Teleprompter):
metric_threshold=None,
):
self.metric = metric
-
- if teacher_settings is None:
- self.teacher_settings = {}
- else:
- self.teacher_settings = teacher_settings
-
+ self.teacher_settings = teacher_settings
self.max_rounds = max_rounds
self.num_threads = num_threads
@@ -73,12 +68,6 @@ class BootstrapFewShotWithRandomSearch(Teleprompter):
all_subscores = []
score_data = []
- if teacher:
- if hasattr(teacher, "candidate_programs"):
- teacher.candidate_programs = teacher.candidate_programs[:1]
- elif hasattr(teacher, "programs"):
- teacher = teacher.programs[0]
-
for seed in range(-3, self.num_candidate_sets):
if (restrict is not None) and (seed not in restrict):
continue