Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

Update BootstrapFewShotWithRandomSearch.md

arnavsinghvi110c31cf835cdd
diff --git a/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md b/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md
index 1a36af2a8..7b5897465 100644
--- a/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md
+++ b/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md
@@ -10,15 +10,16 @@ The constructor initializes the `BootstrapFewShotWithRandomSearch` class and set
```python
class BootstrapFewShotWithRandomSearch(BootstrapFewShot):
- def __init__(self, metric, teacher_settings={}, max_bootstrapped_demos=4, max_labeled_demos=16, max_rounds=1, num_candidate_programs=16, num_threads=6):
+ def __init__(self, metric, teacher_settings={}, max_bootstrapped_demos=4, max_labeled_demos=16, max_rounds=1, num_candidate_programs=16, num_threads=6, max_errors=10, stop_at_score=None, metric_threshold=None):
self.metric = metric
self.teacher_settings = teacher_settings
self.max_rounds = max_rounds
-
self.num_threads = num_threads
-
+ self.stop_at_score = stop_at_score
+ self.metric_threshold = metric_threshold
self.min_num_samples = 1
self.max_num_samples = max_bootstrapped_demos
+ self.max_errors = max_errors
self.num_candidate_sets = num_candidate_programs
self.max_num_traces = 1 + int(max_bootstrapped_demos / 2.0 * self.num_candidate_sets)
@@ -32,12 +33,15 @@ class BootstrapFewShotWithRandomSearch(BootstrapFewShot):
**Parameters:**
- `metric` (_callable_, _optional_): Metric function to evaluate examples during bootstrapping. Defaults to `None`.
-- `teacher_settings` (_dict_, _optional_): Settings for teacher predictor. Defaults to empty dictionary.
+- `teacher_settings` (_dict_, _optional_): Settings for teacher predictor. Defaults to an empty dictionary.
- `max_bootstrapped_demos` (_int_, _optional_): Maximum number of bootstrapped demonstrations per predictor. Defaults to 4.
- `max_labeled_demos` (_int_, _optional_): Maximum number of labeled demonstrations per predictor. Defaults to 16.
- `max_rounds` (_int_, _optional_): Maximum number of bootstrapping rounds. Defaults to 1.
-- `num_candidate_programs` (_int_): Number of candidate programs to generate during random search.
-- `num_threads` (_int_): Number of threads used for evaluation during random search.
+- `num_candidate_programs` (_int_): Number of candidate programs to generate during random search. Defaults to 16.
+- `num_threads` (_int_): Number of threads used for evaluation during random search. Defaults to 6.
+- `max_errors` (_int_): Maximum errors permitted during evaluation. Halts run with the latest error message. Defaults to 10. Configure to 1 if no evaluation run error is desired.
+- `stop_at_score` (_float_, _optional_): Score threshold for random search to stop early. Defaults to `None`.
+- `metric_threshold` (_float_, _optional_): Score threshold for metric to determine successful example. Defaults to `None`.
### Method
@@ -56,4 +60,4 @@ teleprompter = BootstrapFewShotWithRandomSearch(teacher_settings=dict({'lm': tea
# Compile!
compiled_rag = teleprompter.compile(student=RAG(), trainset=trainset)
-```
\ No newline at end of file
+```