Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/docs/cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ evaluate_program(your_dspy_program)

## DSPy Optimizers

### dspy.LabeledFewShot
### LabeledFewShot
```python
from dspy.teleprompt import LabeledFewShot

labeled_fewshot_optimizer = dspy.LabeledFewShot(k=8)
labeled_fewshot_optimizer = LabeledFewShot(k=8)
your_dspy_program_compiled = labeled_fewshot_optimizer.compile(student = your_dspy_program, trainset=trainset)
```

### dspy.BootstrapFewShot
### BootstrapFewShot
```python
from dspy.teleprompt import BootstrapFewShot

Expand Down Expand Up @@ -302,7 +302,7 @@ loaded_program = YourProgramClass()
loaded_program.load(path=save_path)
```

### dspy.BootstrapFewShotWithRandomSearch
### BootstrapFewShotWithRandomSearch

```python
from dspy.teleprompt import BootstrapFewShotWithRandomSearch
Expand All @@ -312,10 +312,10 @@ fewshot_optimizer = BootstrapFewShotWithRandomSearch(metric=your_defined_metric,
your_dspy_program_compiled = fewshot_optimizer.compile(student = your_dspy_program, trainset=trainset, valset=devset)

```
Other custom configurations are similar to customizing the `dspy.BootstrapFewShot` optimizer.
Other custom configurations are similar to customizing the `BootstrapFewShot` optimizer.


### dspy.Ensemble
### Ensemble

```python
from dspy.teleprompt import BootstrapFewShotWithRandomSearch
Expand All @@ -329,7 +329,7 @@ programs = [x[-1] for x in your_dspy_program_compiled.candidate_programs]
your_dspy_program_compiled_ensemble = ensemble_optimizer.compile(programs[:3])
```

### dspy.BootstrapFinetune
### BootstrapFinetune

```python
from dspy.teleprompt import BootstrapFewShotWithRandomSearch, BootstrapFinetune
Expand All @@ -356,7 +356,7 @@ for p in finetune_program.predictors():
p.activated = False
```

### dspy.COPRO
### COPRO

```python
from dspy.teleprompt import COPRO
Expand All @@ -368,7 +368,7 @@ copro_teleprompter = COPRO(prompt_model=model_to_generate_prompts, task_model=mo
compiled_program_optimized_signature = copro_teleprompter.compile(your_dspy_program, trainset=trainset, eval_kwargs=eval_kwargs)
```

### dspy.MIPRO
### MIPRO


```python
Expand All @@ -395,7 +395,7 @@ compiled_program = optimize_signature(
).program
```

### dspy.KNNFewShot
### KNNFewShot

```python
from dspy.predict import KNN
Expand All @@ -406,7 +406,7 @@ knn_optimizer = KNNFewShot(KNN, k=3, trainset=trainset)
your_dspy_program_compiled = knn_optimizer.compile(student=your_dspy_program, trainset=trainset, valset=devset)
```

### dspy.BootstrapFewShotWithOptuna
### BootstrapFewShotWithOptuna

```python
from dspy.teleprompt import BootstrapFewShotWithOptuna
Expand Down