Datasets¶
- class aisploit.datasets.Prompt(name: str, skip: bool, source: str, language: str, tags: Sequence[str], parameters: Sequence[str], template: str)¶
Bases:
YamlDeserializable
A prompt configuration.
- language: str¶
- name: str¶
- parameters: Sequence[str]¶
- skip: bool¶
- source: str¶
- tags: Sequence[str]¶
- template: str¶
- class aisploit.datasets.PromptDataset(prompts: Sequence[Prompt])¶
Bases:
DataclassDataset
[Prompt
]Dataset for prompts.
- classmethod load_from_directory(path: Path, tags_filter: Sequence[str] | None = None) PromptDataset ¶
Create a JailbreakDataset instance by loading prompts from a directory.
- Args:
path (Path): The path to the directory containing prompt YAML files. tags_filter (Sequence[str], optional): Tags to filter prompts. Defaults to None.
- Returns:
JailbreakDataset: A dataset containing prompts loaded from the directory.
- class aisploit.datasets.Sample(skip: bool, input: str, output: str, language: str, tags: Sequence[str])¶
Bases:
YamlDeserializable
A sample configuration.
- input: str¶
- language: str¶
- output: str¶
- skip: bool¶
- tags: Sequence[str]¶
- class aisploit.datasets.SampleDataset(samples: Sequence[Sample])¶
Bases:
DataclassDataset
[Sample
]Dataset for samples.
- classmethod load_from_directory(path: Path, tags_filter: Sequence[str] | None = None) SampleDataset ¶
Create a SampleDataset instance by loading samples from a directory.
- Args:
path (Path): The path to the directory containing sample YAML files. tags_filter (Optional[Sequence[str]], optional): Tags to filter samples. Defaults to None.
- Returns:
SampleDataset: A dataset containing samples loaded from the directory.