Skip to contents

labeled_few_shot() uses up to k rows as they are. bootstrap_few_shot() runs the function (or a stronger teacher model) on the rows and keeps the runs that were right, whole (reasoning and tool calls included), then fills up with labeled rows.

Usage

labeled_few_shot(fn, data, k = 16L, sample = TRUE, seed = 0L)

bootstrap_few_shot(
  fn,
  data,
  max_bootstrapped = 4L,
  max_labeled = 16L,
  teacher = NULL,
  metric = NULL,
  threshold = NULL,
  seed = 0L
)

Arguments

fn

An AI function.

data

A data frame with the formula's input and output columns.

k, max_labeled

How many labeled rows at most.

sample

Pick rows at random (seed) rather than the first ones.

seed

The random seed for picking rows.

max_bootstrapped

How many right runs at most.

teacher

A model to write the examples ("gpt-4.1"); default the function's own.

metric

(row, prediction) returning a score; a run counts when it is above 0 (or at least threshold). Default: exact_match().

threshold

See metric.

Value

An AI function.

Examples

if (FALSE) { # \dontrun{
taught <- mood |> labeled_few_shot(train, k = 8)
} # }