Skip to main content

FewShotGenerator

A generator for creating synthetic datapoints using few-shot learning. This class leverages a seed dataset, an agent, and a verifier to generate new synthetic datapoints on demand through few-shot prompting.

init

Initialize the few-shot generator. Parameters:
  • seed_dataset (StaticDataset): Validated static dataset to use for examples.
  • verifier (BaseVerifier): Verifier to validate generated content.
  • model (BaseModelBackend): The underlying LLM that the generating agent will be initiated with.
  • seed (int): Random seed for reproducibility. (default: :obj:42) **kwargs: Additional generator parameters. (default: 42)

_validate_seed_dataset

_construct_prompt

Construct a prompt for generating new datapoints using a fixed sample of examples from the seed dataset. Parameters:
  • examples (List[DataPoint]): Examples to include in the prompt.
Returns: str: Formatted prompt with examples.