pyrit.prompt_target.PromptTarget#
- class PromptTarget(verbose: bool = False, max_requests_per_minute: int | None = None, endpoint: str = '', model_name: str = '', underlying_model: str | None = None)[source]#
Bases:
Identifiable[TargetIdentifier]Abstract base class for prompt targets.
A prompt target is a destination where prompts can be sent to interact with various services, models, or APIs. This class defines the interface that all prompt targets must implement.
- __init__(verbose: bool = False, max_requests_per_minute: int | None = None, endpoint: str = '', model_name: str = '', underlying_model: str | None = None) None[source]#
Initialize the PromptTarget.
- Parameters:
verbose (bool) – Enable verbose logging. Defaults to False.
max_requests_per_minute (int, Optional) – Maximum number of requests per minute.
endpoint (str) – The endpoint URL. Defaults to empty string.
model_name (str) – The model name. Defaults to empty string.
underlying_model (str, Optional) – The underlying model name (e.g., “gpt-4o”) for identification purposes. This is useful when the deployment name in Azure differs from the actual model. If not provided, model_name will be used for the identifier. Defaults to None.
Methods
__init__([verbose, max_requests_per_minute, ...])Initialize the PromptTarget.
Dispose database engine to release database connections and resources.
get_identifier()Get the typed identifier for this object.
send_prompt_async(*, message)Send a normalized prompt async to the prompt target.
set_model_name(*, model_name)Set the model name for this target.
Attributes
A list of PromptConverters that are supported by the prompt target.
- dispose_db_engine() None[source]#
Dispose database engine to release database connections and resources.
- abstract async send_prompt_async(*, message: Message) list[Message][source]#
Send a normalized prompt async to the prompt target.