pyrit.prompt_target.AzureBlobStorageTarget#

class AzureBlobStorageTarget(*, container_url: str | None = None, sas_token: str | None = None, blob_content_type: SupportedContentType = SupportedContentType.PLAIN_TEXT, max_requests_per_minute: int | None = None)[source]#

Bases: PromptTarget

The AzureBlobStorageTarget takes prompts, saves the prompts to a file, and stores them as a blob in a provided storage account container.

Parameters:
  • container_url (str) – URL to the Azure Blob Storage Container.

  • sas_token (optional[str]) – Optional Blob SAS token needed to authenticate blob operations. If not provided, a delegation SAS token will be created using Entra ID authentication.

  • blob_content_type (SupportedContentType) – Expected Content Type of the blob, chosen from the SupportedContentType enum. Set to PLAIN_TEXT by default.

  • max_requests_per_minute (int, Optional) – Number of requests the target can handle per minute before hitting a rate limit. The number of requests sent to the target will be capped at the value provided.

__init__(*, container_url: str | None = None, sas_token: str | None = None, blob_content_type: SupportedContentType = SupportedContentType.PLAIN_TEXT, max_requests_per_minute: int | None = None) None[source]#

Methods

__init__(*[, container_url, sas_token, ...])

dispose_db_engine()

Dispose DuckDB database engine to release database connections and resources.

get_identifier()

send_prompt_async(**kwargs)

Sends a normalized prompt async to the prompt target.

Attributes

AZURE_STORAGE_CONTAINER_ENVIRONMENT_VARIABLE: str = 'AZURE_STORAGE_ACCOUNT_CONTAINER_URL'#
SAS_TOKEN_ENVIRONMENT_VARIABLE: str = 'AZURE_STORAGE_ACCOUNT_SAS_TOKEN'#
async send_prompt_async(**kwargs)#

Sends a normalized prompt async to the prompt target.