@@ -101,7 +101,7 @@ You can choose only selected columns from the csv by specifying them in the argu
101101``` python
102102dolly_100_dataset = dl.from_csv(
103103 " dolly_subset_100_rows.csv" ,
104- fields = [ " instruction" , " context" , " response" ] ,
104+ fields = ( " instruction" , " context" , " response" ) ,
105105 input_keys = (" instruction" , " context" )
106106)
107107```
@@ -301,13 +301,15 @@ Other custom configurations are similar to customizing the `dspy.BootstrapFewSho
301301### dspy.Ensemble
302302
303303``` python
304- from dspy.teleprompt import BootstrapFewShotWithRandomSearch, Ensemble
304+ from dspy.teleprompt import BootstrapFewShotWithRandomSearch
305+ from dspy.teleprompt.ensemble import Ensemble
305306
306307fewshot_optimizer = BootstrapFewShotWithRandomSearch(metric = your_defined_metric, max_bootstrapped_demos = 2 , num_candidate_programs = 8 , num_threads = NUM_THREADS )
307308your_dspy_program_compiled = fewshot_optimizer.compile(student = your_dspy_program, trainset = trainset, valset = devset)
308309
309- ensemble_optimizer = dspy.Ensemble(reduce_fn = dspy.majority)
310- your_dspy_program_compiled_ensemble = ensemble_optimizer.compile(your_dspy_program_compiled.programs[:3 ])
310+ ensemble_optimizer = Ensemble(reduce_fn = dspy.majority)
311+ programs = [x[- 1 ] for x in your_dspy_program_compiled.candidate_programs]
312+ your_dspy_program_compiled_ensemble = ensemble_optimizer.compile(programs[:3 ])
311313```
312314
313315### dspy.BootstrapFinetune
0 commit comments