pyrit.memory.SeedEntry#
- class SeedEntry(*, entry)[source]#
Bases:
BaseRepresents the raw prompt or prompt template data as found in open datasets.
Note: This is different from the PromptMemoryEntry which is the processed prompt data. SeedPrompt merely reflects basic prompts before plugging into attacks, running through models with corresponding attack strategies, and applying converters. PromptMemoryEntry captures the processed prompt data before and after the above steps.
- Parameters:
__tablename__ (str) – The name of the database table.
__table_args__ (dict) – Additional arguments for the database table.
id (Uuid) – The unique identifier for the memory entry.
value (str) – The value of the seed prompt.
value_sha256 (str) – The SHA256 hash of the value of the seed prompt data.
data_type (PromptDataType) – The data type of the seed prompt.
dataset_name (str) – The name of the dataset the seed prompt belongs to.
harm_categories (List[str]) – The harm categories associated with the seed prompt.
description (str) – The description of the seed prompt.
authors (List[str]) – The authors of the seed prompt.
groups (List[str]) – The groups involved in authoring the seed prompt (if any).
source (str) – The source of the seed prompt.
date_added (DateTime) – The date the seed prompt was added.
added_by (str) – The user who added the seed prompt.
prompt_metadata (dict[str, str | int]) – The metadata associated with the seed prompt. This includes information that is useful for the specific target you’re probing, such as encoding data.
parameters (List[str]) – The parameters included in the value. Note that seed prompts do not have parameters, only prompt templates do. However, they are stored in the same table.
prompt_group_id (uuid.UUID) – The ID of a group the seed prompt may optionally belong to. Groups are used to organize prompts for multi-turn conversations or multi-modal prompts.
sequence (int) – The turn of the seed prompt in a group. When entire multi-turn conversations are stored, this is used to order the prompts.
role (str) – The role of the prompt (e.g., user, system, assistant).
is_objective (bool) – Whether this prompt is used as an objective.
- __str__()#
Returns a string representation of the memory entry.
- __init__(*, entry)#
Initialize a SeedEntry from a Seed object.
- Parameters:
entry (Seed) – The seed object to convert into a database entry.
Methods
__init__(*, entry)Initialize a SeedEntry from a Seed object.
get_seed()Convert this database entry back into a Seed object.
Attributes
metadataRefers to the
_schema.MetaDatacollection that will be used for new_schema.Tableobjects.registryRefers to the
_orm.registryin use where new_orm.Mapperobjects will be associated.- added_by#
- data_type: Mapped[Literal['text', 'image_path', 'audio_path', 'video_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output']]#
- dataset_name#
- date_added#
- description#
- get_seed() Seed[source]#
Convert this database entry back into a Seed object.
- Returns:
The reconstructed seed object (SeedPrompt or SeedObjective)
- Return type:
Seed
- id#
- name#
- source#
- value#
- value_sha256#