pyrit.prompt_converter.ToneConverter

pyrit.prompt_converter.ToneConverter#

class ToneConverter(*, converter_target: PromptChatTarget, tone: str, prompt_template: SeedPrompt = None)[source]#

Bases: LLMGenericTextConverter

__init__(*, converter_target: PromptChatTarget, tone: str, prompt_template: SeedPrompt = None)[source]#

Converts a conversation to a different tone

Parameters:
  • converter_target (PromptChatTarget) – The target chat support for the conversion which will translate

  • tone (str) – The tone for the conversation. E.g. upset, sarcastic, indifferent, etc.

  • prompt_template (SeedPrompt, Optional) – The prompt template for the conversion.

Raises:

ValueError – If the language is not provided.

Methods

__init__(*, converter_target, tone[, ...])

Converts a conversation to a different tone

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