pyrit.prompt_normalizer.PromptNormalizer#
- class PromptNormalizer[source]#
Bases:
ABC
Methods
__init__
()send_prompt_async
(*, normalizer_request, target)Sends a single request to a target.
send_prompt_batch_to_target_async
(*, ...[, ...])Sends a batch of prompts to the target asynchronously.
- async convert_response_values(response_converter_configurations: list[PromptResponseConverterConfiguration], prompt_response: PromptRequestResponse)[source]#
- async send_prompt_async(*, normalizer_request: NormalizerRequest, target: PromptTarget, sequence: int = -1, labels: dict[str, str] | None = None, orchestrator_identifier: dict[str, str] | None = None) PromptRequestResponse [source]#
Sends a single request to a target.
- Parameters:
normalizer_request (NormalizerRequest) – The request to be sent.
target (PromptTarget) – The target to send the request to.
sequence (int, Optional) – The sequence number. Defaults to -1.
labels (dict[str, str], Optional) – Additional labels for the request. Defaults to None.
orchestrator_identifier (dict[str, str], Optional) – The orchestrator identifier. Defaults to None.
- Returns:
The response received from the target.
- Return type:
- async send_prompt_batch_to_target_async(*, requests: list[NormalizerRequest], target: PromptTarget, labels: dict[str, str] | None = None, orchestrator_identifier: dict[str, str] | None = None, batch_size: int = 10) list[PromptRequestResponse] [source]#
Sends a batch of prompts to the target asynchronously.
- Parameters:
requests (list[NormalizerRequest]) – A list of NormalizerRequest objects representing the prompts to be sent.
target (PromptTarget) – The target to which the prompts should be sent.
labels (dict[str, str], Optional) – Additional labels to be included with the prompts. Defaults to None
orchestrator_identifier (dict[str, str], Optional) – The identifier of the orchestrator used for sending the prompts. Defaults to None.
batch_size (int, Optional) – The size of each batch of prompts. Defaults to 10.
- Returns:
- A list of PromptRequestResponse objects representing the responses
received for each prompt.
- Return type: