pyrit.datasets.fetch_examples

Contents

pyrit.datasets.fetch_examples#

fetch_examples(source: str, source_type: Literal['public_url', 'file'] = 'public_url', cache: bool = True, data_home: Path | None = None) List[Dict[str, str]][source]#

Fetch examples from a specified source with caching support.

Example usage >>> examples = fetch_examples( >>> source=’https://raw.githubusercontent.com/KutalVolkan/many-shot-jailbreaking-dataset/5eac855/examples.json’, >>> source_type=’public_url’ >>> )

Parameters:
  • source (str) – The source from which to fetch examples.

  • source_type (Literal["public_url", "file"]) – The type of source (‘public_url’ or ‘file’).

  • cache (bool) – Whether to cache the fetched examples. Defaults to True.

  • data_home (Optional[Path]) – Directory to store cached data. Defaults to None.

Returns:

A list of examples.

Return type:

List[Dict[str, str]]