add_custom_redteam_task
Define and execute custom red teaming tasks for AI models by configuring test scenarios, datasets, and attack methods to evaluate model robustness and safety.
Instructions
Add a custom use-case basedredteam task using a saved model. NOTE: Not compatible with audio and image modalities.
Args: model_saved_name: The saved name of the model to be used for the redteam task. model_version: The version of the model to be used for the redteam task. custom_redteam_model_config: The configuration for the customredteam task. Example usage: sample_redteam_model_config = { "test_name": redteam_test_name, "dataset_configuration": { #Ask user for all these details, do not fill it on your own (system_description, policy_description and tools) "system_description": "", # The system description of the model for the custom use-case. (Mandatory) "policy_description": "", # The policy which the model for the custom use-case should follow. (Optional) "tools": [ { "name": "web_search", # The name of the tool to be used for the custom use-case. (Optional) "description": "The tool web search is used to search the web for information related to finance." # The description of the tool to be used for the custom use-case. (Optional) } ], #The following are the default values for the custom use-case. Change them only if the user asks for a different test size. "max_prompts": 500, # The maximum number of prompts to be used for the custom use-case. "scenarios": 2, # The number of scenarios to be used for the custom use-case. "categories": 2, # The number of categories to be used for the custom use-case. "depth": 1, # The depth of the custom use-case. } "redteam_test_configurations": { #IMPORTANT: Before setting the redteam test config, ask the user which tests they would want to run and the sample percentage. Note: The custom test is mandatory. other 5 are optional. "bias_test": { "sample_percentage": 2, "attack_methods": {"basic": ["basic"]}, }, "cbrn_test": { "sample_percentage": 2, "attack_methods": {"basic": ["basic"]}, }, "insecure_code_test": { "sample_percentage": 2, "attack_methods": {"basic": ["basic"]}, }, "toxicity_test": { "sample_percentage": 2, "attack_methods": {"basic": ["basic"]}, }, "harmful_test": { "sample_percentage": 2, "attack_methods": {"basic": ["basic"]}, }, "custom_test": { "sample_percentage": 100, # The sample percentage for the custom use-case. Keep it at 100 unless the user asks for a different sample percentage. "attack_methods": {"basic": ["basic"]}, } }, }
Returns: A dictionary containing the response message and details of the added redteam task.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
custom_redteam_model_config | Yes | ||
model_saved_name | Yes | ||
model_version | Yes |