pyrit.prompt_target.GandalfTarget#
- class GandalfTarget(*, level: GandalfLevel, max_requests_per_minute: int | None = None)[source]#
Bases:
PromptTargetA prompt target for the Gandalf security challenge.
- __init__(*, level: GandalfLevel, max_requests_per_minute: int | None = None) None[source]#
Initialize the Gandalf target.
- Parameters:
level (GandalfLevel) – The Gandalf level to target.
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.
Methods
__init__(*, level[, max_requests_per_minute])Initialize the Gandalf target.
check_password(password)Check if the password is correct.
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
A list of PromptConverters that are supported by the prompt target.
- async check_password(password: str) bool[source]#
Check if the password is correct.
- Returns:
True if the password is correct, False otherwise.
- Return type:
- Raises:
ValueError – If the chat returned an empty response.