pyrit.models.ErrorDataTypeSerializer#

class ErrorDataTypeSerializer(*, prompt_text: str)[source]#

Bases: DataTypeSerializer

Serializer for error payloads stored as in-memory text.

__init__(*, prompt_text: str)[source]#

Initialize an error serializer.

Parameters:

prompt_text (str) – Error payload text.

Methods

__init__(*, prompt_text)

Initialize an error serializer.

data_on_disk()

Indicate whether this serializer persists data on disk.

get_data_filename([file_name])

Generate or retrieve a unique filename for the data file.

get_extension(file_path)

Get the file extension from the file path.

get_mime_type(file_path)

Get the MIME type of the file path.

get_sha256()

Compute SHA256 hash for this serializer's current value.

read_data()

Read data from storage.

read_data_base64()

Read data from storage and return it as a base64 string.

save_b64_image(data[, output_filename])

Save a base64-encoded image to storage.

save_data(data[, output_filename])

Save data to storage.

save_formatted_audio(data[, num_channels, ...])

Save PCM16 or similarly formatted audio data to storage.

Attributes

category: str#
data_on_disk() bool[source]#

Indicate whether this serializer persists data on disk.

Returns:

Always False for error serializers.

Return type:

bool

data_sub_directory: str#
data_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'binary_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output']#
file_extension: str#
value: str#