Skip to content

Commit 0c31cf8

Browse files
Update BootstrapFewShotWithRandomSearch.md
1 parent 4379ead commit 0c31cf8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/api/optimizers/BootstrapFewShotWithRandomSearch.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ The constructor initializes the `BootstrapFewShotWithRandomSearch` class and set
1010

1111
```python
1212
class BootstrapFewShotWithRandomSearch(BootstrapFewShot):
13-
def __init__(self, metric, teacher_settings={}, max_bootstrapped_demos=4, max_labeled_demos=16, max_rounds=1, num_candidate_programs=16, num_threads=6):
13+
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):
1414
self.metric = metric
1515
self.teacher_settings = teacher_settings
1616
self.max_rounds = max_rounds
17-
1817
self.num_threads = num_threads
19-
18+
self.stop_at_score = stop_at_score
19+
self.metric_threshold = metric_threshold
2020
self.min_num_samples = 1
2121
self.max_num_samples = max_bootstrapped_demos
22+
self.max_errors = max_errors
2223
self.num_candidate_sets = num_candidate_programs
2324
self.max_num_traces = 1 + int(max_bootstrapped_demos / 2.0 * self.num_candidate_sets)
2425

@@ -32,12 +33,15 @@ class BootstrapFewShotWithRandomSearch(BootstrapFewShot):
3233

3334
**Parameters:**
3435
- `metric` (_callable_, _optional_): Metric function to evaluate examples during bootstrapping. Defaults to `None`.
35-
- `teacher_settings` (_dict_, _optional_): Settings for teacher predictor. Defaults to empty dictionary.
36+
- `teacher_settings` (_dict_, _optional_): Settings for teacher predictor. Defaults to an empty dictionary.
3637
- `max_bootstrapped_demos` (_int_, _optional_): Maximum number of bootstrapped demonstrations per predictor. Defaults to 4.
3738
- `max_labeled_demos` (_int_, _optional_): Maximum number of labeled demonstrations per predictor. Defaults to 16.
3839
- `max_rounds` (_int_, _optional_): Maximum number of bootstrapping rounds. Defaults to 1.
39-
- `num_candidate_programs` (_int_): Number of candidate programs to generate during random search.
40-
- `num_threads` (_int_): Number of threads used for evaluation during random search.
40+
- `num_candidate_programs` (_int_): Number of candidate programs to generate during random search. Defaults to 16.
41+
- `num_threads` (_int_): Number of threads used for evaluation during random search. Defaults to 6.
42+
- `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.
43+
- `stop_at_score` (_float_, _optional_): Score threshold for random search to stop early. Defaults to `None`.
44+
- `metric_threshold` (_float_, _optional_): Score threshold for metric to determine successful example. Defaults to `None`.
4145

4246
### Method
4347

@@ -56,4 +60,4 @@ teleprompter = BootstrapFewShotWithRandomSearch(teacher_settings=dict({'lm': tea
5660

5761
# Compile!
5862
compiled_rag = teleprompter.compile(student=RAG(), trainset=trainset)
59-
```
63+
```

0 commit comments

Comments
 (0)