Python
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."
]
}Red Teaming
Create red team spec
Create a new red team specification
POST
/
api
/
dataframer
/
red-team-specs
/
Python
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
Spec names are automatically converted to snake_case and must be unique within your company.
Authorizations
Body
application/json
Request body for creating a red team spec
Response
Red team spec created successfully

