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:
PromptTargetThe 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]#
Initialize the Azure Blob Storage target.
- Parameters:
container_url (str, Optional) – The Azure Storage container URL. Defaults to the AZURE_STORAGE_ACCOUNT_CONTAINER_URL environment variable.
sas_token (str, Optional) – The SAS token for authentication. Defaults to the AZURE_STORAGE_ACCOUNT_SAS_TOKEN environment variable.
blob_content_type (SupportedContentType) – The content type for blobs. Defaults to PLAIN_TEXT.
max_requests_per_minute (int, Optional) – Maximum number of requests per minute.
Methods
__init__(*[, container_url, sas_token, ...])Initialize the Azure Blob Storage target.
dispose_db_engine()Dispose database engine to release database connections and resources.
get_identifier()Get an identifier dictionary for this prompt target.
send_prompt_async(**kwargs)Send a normalized prompt async to the prompt target.
set_model_name(*, model_name)Set the model name for this target.
Attributes
supported_convertersA list of PromptConverters that are supported by the prompt target.