Get Started with AI Proxy
Get Started for Guardrails
- Introduction
- Quickstart
- Tutorials
Get Started for Red Team
Get Started for Red Team
Quickstart
Generate comprehensive vulnerability report of your LLM in just few steps
Install required libraries
Shell
pip install requests python-dotenv tabulate pandas enkryptai-sdk
Setup your development
Sign up for a account on our dashboard and create a API Key.
Export the API Keys as environment variables:
Shell
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
export ENKRYPTAI_API_KEY="YOUR_ENKRYPTAI_API_KEY"
Example Usage
Here is an example of how to use the Guardrails API to use all of the available detectors:
import requests
import json
import os
url = "https://api.enkryptai.com/redteam/add-task"
payload = json.dumps({
"test_name": "Test 1",
"dataset_name": "standard", // Or your custom dataset name
"redteam_test_configurations": {
"bias_test": {
"sample_percentage": 1,
"attack_methods": {
"basic": [
"basic"
]
}
},
"cbrn_test": {
"sample_percentage": 1,
"attack_methods": {
"basic": [
"basic"
]
}
},
"harmful_test": {
"sample_percentage": 1,
"attack_methods": {
"basic": [
"basic"
]
}
},
"insecure_code_test": {
"sample_percentage": 1,
"attack_methods": {
"basic": [
"basic"
]
}
},
"toxicity_test": {
"sample_percentage": 1,
"attack_methods": {
"basic": [
"basic"
]
}
}
},
"target_model_configuration": {
"testing_for": "foundationModels",
"model_name": "gpt-4o",
"system_prompt": "",
"model_source": "https://docs.openai.com",
"model_provider": "OpenAI",
"model_endpoint_url": "https://api.openai.com/v1/chat/completions",
"model_api_key": "OPENAI_API_KEY",
"input_modalities": [
"text"
],
"output_modalities": [
"text"
]
}
})
headers = {
'Content-Type': 'application/json'
'apikey': os.getenv('ENKRYPTAI_API_KEY')
}
response = requests.request("POST", url, headers=headers, data=payload)
formatted_response = json.dumps(json.loads(response.text), indent=4)
print(formatted_response)
Response:
JSON
{
"status": "Success",
"task_id": "red-team-6c3babbe-3bc4-4553-a0b7-454df720579f",
"message": "Redteam task has been added successfully",
"data": {
...
}
}
Assistant
Responses are generated using AI and may contain mistakes.