pyrit.models.TextDataTypeSerializer#
- class TextDataTypeSerializer(*, prompt_text: str, data_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output'] = 'text')[source]#
Bases:
DataTypeSerializer- __init__(*, prompt_text: str, data_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output'] = 'text')[source]#
Methods
__init__(*, prompt_text[, data_type])Returns True if the data is stored on disk.
get_data_filename([file_name])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()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[, output_filename])Saves the data to storage.
save_formatted_audio(data[, num_channels, ...])Saves the PCM16 of other specially formatted audio data to storage.
Attributes