pyrit.prompt_converter.TenseConverter

pyrit.prompt_converter.TenseConverter#

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

Bases: LLMGenericTextConverter

Converts a conversation to a different tense using an LLM.

An existing PromptChatTarget is used to perform the conversion (like Azure OpenAI).

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

Initializes the converter with the target chat support, tense, and optional prompt template.

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

  • tone (str) – The tense the converter should convert the prompt to. E.g. past, present, future.

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

Raises:

ValueError – If the language is not provided.

Methods

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

Initializes the converter with the target chat support, tense, and optional prompt template.

convert_async(*, prompt[, input_type])

Converts the given prompt using an LLM via the specified converter target.

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

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

get_identifier()

Returns an identifier dictionary for the converter.

input_supported(input_type)

Checks if the input type is supported by the converter.

output_supported(output_type)

Checks if the output type is supported by the converter.

Attributes

supported_input_types

Returns a list of supported input types for the converter.

supported_output_types

Returns a list of supported output types for the converter.