pyrit.prompt_converter.MaliciousQuestionGeneratorConverter#
- class MaliciousQuestionGeneratorConverter(*, converter_target: PromptChatTarget = REQUIRED_VALUE, prompt_template: SeedPrompt | None = None)[source]#
Bases:
LLMGenericTextConverterGenerates malicious questions using an LLM.
An existing
PromptChatTargetis used to perform the conversion (like Azure OpenAI).- __init__(*, converter_target: PromptChatTarget = REQUIRED_VALUE, prompt_template: SeedPrompt | None = None)[source]#
Initialize the converter with a specific target and template.
- Parameters:
converter_target (PromptChatTarget) – The endpoint that converts the prompt. Can be omitted if a default has been configured via PyRIT initialization.
prompt_template (SeedPrompt) – The seed prompt template to use.
Methods
__init__(*[, converter_target, prompt_template])Initialize the converter with a specific target and template.
convert_async(*, prompt[, input_type])Convert the input prompt into malicious questions.
convert_tokens_async(*, prompt[, ...])Convert substrings within a prompt that are enclosed by specified start and end tokens.
get_identifier()Return an identifier dictionary for the converter.
input_supported(input_type)Check if the input type is supported.
output_supported(output_type)Check if the output type is supported.
Attributes
SUPPORTED_INPUT_TYPESTuple of input modalities supported by this converter.
SUPPORTED_OUTPUT_TYPESTuple of output modalities supported by this converter.
supported_input_typesReturns a list of supported input types for the converter.
supported_output_typesReturns a list of supported output types for the converter.
- async convert_async(*, prompt: str, input_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'binary_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output'] = 'text') ConverterResult[source]#
Convert the input prompt into malicious questions.
- Parameters:
prompt (str) – The input prompt to convert.
input_type (PromptDataType) – The type of the input prompt. Must be “text”.
- Returns:
The result of the conversion.
- Return type:
- input_supported(input_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'binary_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output']) bool[source]#
Check if the input type is supported.
- Parameters:
input_type (PromptDataType) – The type of the input prompt.
- Returns:
True if the input type is “text”, False otherwise.
- Return type:
- output_supported(output_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'binary_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output']) bool[source]#
Check if the output type is supported.
- Parameters:
output_type (PromptDataType) – The desired type of the output prompt.
- Returns:
True if the output type is “text”, False otherwise.
- Return type: