pyrit.models.SeedPrompt#

class SeedPrompt(*, id: UUID | None = None, value: str, data_type: Literal['text', 'image_path', 'audio_path', 'url', 'error'], name: str | None = None, dataset_name: str | None = None, harm_categories: List[str] | None = None, description: str | None = None, authors: List[str] | None = None, groups: List[str] | None = None, source: str | None = None, date_added: datetime | None = datetime.datetime(2024, 12, 29, 4, 50, 6, 357406), added_by: str | None = None, metadata: Dict[str, str] | None = None, parameters: List[str] | None = None, prompt_group_id: UUID | None = None, sequence: int | None = None)[source]#

Bases: YamlLoadable

Represents a seed prompt with various attributes and metadata.

__init__(*, id: UUID | None = None, value: str, data_type: Literal['text', 'image_path', 'audio_path', 'url', 'error'], name: str | None = None, dataset_name: str | None = None, harm_categories: List[str] | None = None, description: str | None = None, authors: List[str] | None = None, groups: List[str] | None = None, source: str | None = None, date_added: datetime | None = datetime.datetime(2024, 12, 29, 4, 50, 6, 357406), added_by: str | None = None, metadata: Dict[str, str] | None = None, parameters: List[str] | None = None, prompt_group_id: UUID | None = None, sequence: int | None = None)[source]#

Methods

__init__(*[, id, name, dataset_name, ...])

from_yaml_file(file)

Creates a new object from a YAML file.

render_template_value(**kwargs)

Renders self.value as a template, applying provided parameters in kwargs

Attributes

added_by: str | None#
authors: List[str] | None#
data_type: Literal['text', 'image_path', 'audio_path', 'url', 'error']#
dataset_name: str | None#
date_added: datetime | None#
description: str | None#
groups: List[str] | None#
harm_categories: List[str] | None#
id: UUID | None#
metadata: Dict[str, str] | None#
name: str | None#
parameters: List[str] | None#
prompt_group_id: UUID | None#
render_template_value(**kwargs) str[source]#

Renders self.value as a template, applying provided parameters in kwargs

Parameters:

kwargs – Key-value pairs to replace in the SeedPrompt value.

Returns:

A new prompt with the parameters applied.

Raises:

ValueError – If parameters are missing or invalid in the template.

sequence: int | None#
source: str | None#
value: str#