Skip to content

Commit

Permalink
Update BootstrapFewShotWithRandomSearch.md
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavsinghvi11 authored Jun 19, 2024
1 parent 4379ead commit 0c31cf8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions docs/api/optimizers/BootstrapFewShotWithRandomSearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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

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

# Compile!
compiled_rag = teleprompter.compile(student=RAG(), trainset=trainset)
```
```

0 comments on commit 0c31cf8

Please sign in to comment.