pyrit.models.VideoPathDataTypeSerializer#

class VideoPathDataTypeSerializer(*, category: str, prompt_text: str | None = None, extension: str | None = None)[source]#

Bases: DataTypeSerializer

Serializer for video path values stored on disk.

__init__(*, category: str, prompt_text: str | None = None, extension: str | None = None)[source]#

Initialize a video-path serializer.

Parameters:
  • category (str) – The category or context for the data.

  • prompt_text (Optional[str]) – The video path or identifier.

  • extension (Optional[str]) – The file extension, defaults to ‘mp4’.

Methods

__init__(*, category[, prompt_text, extension])

Initialize a video-path 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 True for video path serializers.

Return type:

bool

data_sub_directory: str#
data_type: PromptDataType#
file_extension: str#
value: str#