pyrit.memory.PromptMemoryEntry#
- class PromptMemoryEntry(*, entry)[source]#
Bases:
Base
Represents the prompt data.
Because of the nature of database and sql alchemy, type ignores are abundant :)
- 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.
role (PromptType) – system, assistant, user
conversation_id (str) – The identifier for the conversation which is associated with a single target.
sequence (int) – The order of the conversation within a conversation_id. Can be the same number for multi-part requests or multi-part responses.
timestamp (DateTime) – The timestamp of the memory entry.
labels (Dict[str, str]) – The labels associated with the memory entry. Several can be standardized.
prompt_metadata (JSON) – The metadata associated with the prompt. This can be specific to any scenarios. Because memory is how components talk with each other, this can be component specific. e.g. the URI from a file uploaded to a blob store, or a document type you want to upload.
converters (list[PromptConverter]) – The converters for the prompt.
prompt_target (PromptTarget) – The target for the prompt.
orchestrator_identifier (Dict[str, str]) – The orchestrator identifier for the prompt.
original_value_data_type (PromptDataType) – The data type of the original prompt (text, image)
original_value (str) – The text of the original prompt. If prompt is an image, it’s a link.
original_value_sha256 (str) – The SHA256 hash of the original prompt data.
converted_value_data_type (PromptDataType) – The data type of the converted prompt (text, image)
converted_value (str) – The text of the converted prompt. If prompt is an image, it’s a link.
converted_value_sha256 (str) – The SHA256 hash of the original prompt data.
idx_conversation_id (Index) – The index for the conversation ID.
original_prompt_id (UUID) – The original prompt id. It is equal to id unless it is a duplicate.
- __init__(*, entry)#
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
Methods
__init__
(*, entry)A simple constructor that allows initialization from kwargs.
Attributes
metadata
Refers to the
_schema.MetaData
collection that will be used for new_schema.Table
objects.registry
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.- conversation_id#
- converted_value#
- converted_value_sha256#
- get_prompt_request_piece() PromptRequestPiece [source]#
- id#
- idx_conversation_id = Index('idx_conversation_id', 'conversation_id')#
- original_prompt_id#
- original_value#
- original_value_sha256#
- prompt_metadata#
- sequence#
- timestamp#