import os
from dataframer import Dataframer
client = Dataframer(
api_key=os.environ.get("DATAFRAMER_API_KEY"), # This is the default and can be omitted
)
red_team_spec = client.dataframer.red_team_specs.create(
app_description="A patient-facing chatbot that helps schedule appointments and answer general health questions",
domain_description="Healthcare and medical information services",
name="Healthcare Chatbot",
concerns="Should not provide medical diagnoses, prescription recommendations, or treatment advice",
)
print(red_team_spec.id)curl https://df-api.dataframer.ai/api/dataframer/red-team-specs/ \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $DATAFRAMER_API_KEY" \
-d '{
"app_description": "A patient-facing chatbot that helps schedule appointments and answer general health questions",
"domain_description": "Healthcare and medical information services",
"name": "Healthcare Chatbot",
"concerns": "Should not provide medical diagnoses, prescription recommendations, or treatment advice"
}'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"domain_description": "<string>",
"app_description": "<string>",
"concerns": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": 123,
"created_by_email": "<string>"
}{
"name": [
"Red Team Spec with name \"my_spec\" already exists"
],
"domain_description": [
"This field is required."
],
"app_description": [
"This field is required."
]
}Create red team spec
Create a new red team specification
import os
from dataframer import Dataframer
client = Dataframer(
api_key=os.environ.get("DATAFRAMER_API_KEY"), # This is the default and can be omitted
)
red_team_spec = client.dataframer.red_team_specs.create(
app_description="A patient-facing chatbot that helps schedule appointments and answer general health questions",
domain_description="Healthcare and medical information services",
name="Healthcare Chatbot",
concerns="Should not provide medical diagnoses, prescription recommendations, or treatment advice",
)
print(red_team_spec.id)curl https://df-api.dataframer.ai/api/dataframer/red-team-specs/ \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $DATAFRAMER_API_KEY" \
-d '{
"app_description": "A patient-facing chatbot that helps schedule appointments and answer general health questions",
"domain_description": "Healthcare and medical information services",
"name": "Healthcare Chatbot",
"concerns": "Should not provide medical diagnoses, prescription recommendations, or treatment advice"
}'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"domain_description": "<string>",
"app_description": "<string>",
"concerns": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": 123,
"created_by_email": "<string>"
}{
"name": [
"Red Team Spec with name \"my_spec\" already exists"
],
"domain_description": [
"This field is required."
],
"app_description": [
"This field is required."
]
}What is Red Teaming?
Red teaming generates adversarial prompts designed to test your LLM application’s safety guardrails. Given a description of your application and its domain, it identifies potential undesirable behaviors and creates prompts that attempt to trigger them. Workflow:- Create a red team spec (this endpoint) describing your application
- Create a run to generate adversarial prompts
- Poll the status until complete
- Get the results containing behaviors and adversarial prompts
Authorizations
API Key authentication. Format: "Bearer YOUR_API_KEY"
Body
Request body for creating a red team spec
Name for the spec (will be converted to snake_case, must be unique within company)
Description of the domain or industry the application operates in (e.g., 'Healthcare', 'E-commerce', 'Financial services')
Description of the application being tested, including its purpose and key functionality
Optional specific security concerns or undesirable behaviors to focus on (e.g., 'Should not provide medical diagnoses')
Response
Red team spec created successfully
Unique identifier for the red team spec
Name of the red team spec (auto-converted to snake_case)
Description of the domain or industry the application operates in
Description of the application being tested, including its purpose and functionality
Specific security concerns or behaviors to focus on during red teaming
Timestamp when the spec was created
ID of the user who created this spec
Email of the user who created this spec

