pyrit.models.ImagePathDataTypeSerializer#
- class ImagePathDataTypeSerializer(*, prompt_text: str | None = None, extension: str | None = None)[source]#
Bases:
DataTypeSerializer
Methods
__init__
(*[, prompt_text, extension])Returns True if the data is stored on disk.
get_data_filename
()Generates or retrieves 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
()is_url
(path)Helper function to check if a given path is a URL.
read_data
()Reads the data from the storage.
read_data_base64
()Reads the data from the storage.
save_b64_image
(data[, output_filename])Saves the base64 encoded image to storage.
save_data
(data)Saves the data to storage.
Attributes
data_type
value
data_sub_directory
file_extension