pyrit.prompt_converter.HumanInTheLoopConverter#

class HumanInTheLoopConverter(converters: list[PromptConverter] | None = None)[source]#

Bases: PromptConverter

Allows review of each prompt sent to a target before sending it. User can choose to send the prompt as is, modify the prompt, or run the prompt through one of the passed-in converters before sending it.

Parameters:

converters – (List[PromptConverter], Optional): List of possible converters to run input through.

__init__(converters: list[PromptConverter] | None = None)[source]#

Methods

__init__([converters])

convert_async(*, prompt[, input_type])

Before sending a prompt to a target, user is given three options to choose from: (1) Proceed with sending the prompt as is.

convert_tokens_async(*, prompt[, ...])

Converts substrings within a prompt that are enclosed by specified start and end tokens.

get_identifier()

input_supported(input_type)

Checks if the input type is supported by the converter

async convert_async(*, prompt: str, input_type: Literal['text', 'image_path', 'audio_path', 'url', 'error'] = 'text') ConverterResult[source]#

Before sending a prompt to a target, user is given three options to choose from: (1) Proceed with sending the prompt as is. (2) Manually modify the prompt. (3) Run the prompt through a converter before sending it.

Parameters:
  • prompt (str) – The prompt to be added to the image.

  • input_type (PromptDataType) – Type of data

Returns:

The filename of the converted image as a ConverterResult Object

Return type:

ConverterResult

input_supported(input_type: Literal['text', 'image_path', 'audio_path', 'url', 'error']) bool[source]#

Checks if the input type is supported by the converter

Parameters:

input_type – The input type to check

Returns:

True if the input type is supported, False otherwise

Return type:

bool