pyrit.prompt_converter.NoiseConverter#
- class NoiseConverter(*, converter_target: PromptChatTarget, noise: str | None = None, number_errors: int | None = 5, prompt_template: SeedPrompt = None)[source]#
Bases:
LLMGenericTextConverter
- __init__(*, converter_target: PromptChatTarget, noise: str | None = None, number_errors: int | None = 5, prompt_template: SeedPrompt = None)[source]#
Injects noise errors into a conversation
- Parameters:
converter_target (PromptChatTarget) – The endpoint that converts the prompt
noise (str) – The noise to inject. Grammar error, delete random letter, insert random space, etc.
number_errors (int) – The number of errors to inject
prompt_template (SeedPrompt, Optional) – The prompt template for the conversion.
Methods
__init__
(*, converter_target[, noise, ...])Injects noise errors into a conversation
convert_async
(*, prompt[, input_type])Convert a prompt based on the prompt template
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