best_demos() returns the few-shot demonstrations a module currently
carries, such as those chosen by LabeledFewShot() or BootstrapFewShot().
See also
Other optimization results:
apply_best_config(),
best_params(),
config_diff(),
export_module_code(),
optimization_result(),
optimization_summary(),
top_trials()
Examples
classifier <- module(signature("text -> sentiment"))
trainset <- data.frame(
text = c("I love it!", "Terrible experience", "It's okay"),
sentiment = c("positive", "negative", "neutral")
)
compiled <- compile(classifier, LabeledFewShot(k = 2L), trainset)
best_demos(compiled, as_tibble = TRUE)
#> # A tibble: 2 × 2
#> text output
#> <chr> <chr>
#> 1 It's okay neutral
#> 2 I love it! positive
# An uncompiled module has none
best_demos(classifier)
#> NULL