Generate a guardrail and policy for risk mitigation based on summary
curl --request POST \
--url https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"redteam_summary": {}
}
'import requests
url = "https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy"
payload = { "redteam_summary": {} }
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({redteam_summary: {}})
};
fetch('https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redteam_summary' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy"
payload := strings.NewReader("{\n \"redteam_summary\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"redteam_summary\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"redteam_summary\": {}\n}"
response = http.request(request)
puts response.read_body{
"analysis": "<string>",
"guardrails_policy": {
"topic_detector": {
"enabled": true,
"topic": [
"<string>"
],
"block_message": "<string>"
},
"nsfw": {
"enabled": true,
"block_message": "<string>"
},
"toxicity": {
"enabled": true,
"block_message": "<string>"
},
"pii": {
"enabled": true,
"entities": [
"pii"
]
},
"injection_attack": {
"enabled": true,
"need_explanation": false,
"block_message": "<string>"
},
"keyword_detector": {
"enabled": true,
"banned_keywords": [
"<string>"
]
},
"system_prompt": {
"enabled": false,
"index": "system",
"block_message": "<string>"
},
"copyright_ip": {
"enabled": false,
"block_message": "<string>"
},
"policy_violation": {
"enabled": true,
"rules": [
{
"id": "priv-1",
"text": "The assistant must not provide individualized investment advice.",
"risk_category": "legal_ip_liability",
"applicability": "assistant",
"severity": "medium",
"source": "document",
"suggested": false,
"display_text": "No individualized investment advice",
"frameworks": [
"hipaa"
],
"mappings": [
{
"framework": "<string>",
"clause": "<string>"
}
]
}
],
"policy_text": "<string>",
"coc_policy_name": "<string>",
"need_explanation": true,
"block_message": "<string>"
},
"bias": {
"enabled": true
},
"sponge_attack": {
"enabled": false,
"block_message": "<string>"
}
},
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}🔴 Red Team API
Generate a guardrail and policy for risk mitigation based on summary
Given a run’s results summary, returns a Guardrails detector configuration that blocks the behaviours the run surfaced. Feed the returned guardrails_policy straight into the Guardrails APIs.
POST
/
rt
/
risk-mitigation
/
guardrails-policy
Generate a guardrail and policy for risk mitigation based on summary
curl --request POST \
--url https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"redteam_summary": {}
}
'import requests
url = "https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy"
payload = { "redteam_summary": {} }
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({redteam_summary: {}})
};
fetch('https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redteam_summary' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy"
payload := strings.NewReader("{\n \"redteam_summary\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"redteam_summary\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/rt/risk-mitigation/guardrails-policy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"redteam_summary\": {}\n}"
response = http.request(request)
puts response.read_body{
"analysis": "<string>",
"guardrails_policy": {
"topic_detector": {
"enabled": true,
"topic": [
"<string>"
],
"block_message": "<string>"
},
"nsfw": {
"enabled": true,
"block_message": "<string>"
},
"toxicity": {
"enabled": true,
"block_message": "<string>"
},
"pii": {
"enabled": true,
"entities": [
"pii"
]
},
"injection_attack": {
"enabled": true,
"need_explanation": false,
"block_message": "<string>"
},
"keyword_detector": {
"enabled": true,
"banned_keywords": [
"<string>"
]
},
"system_prompt": {
"enabled": false,
"index": "system",
"block_message": "<string>"
},
"copyright_ip": {
"enabled": false,
"block_message": "<string>"
},
"policy_violation": {
"enabled": true,
"rules": [
{
"id": "priv-1",
"text": "The assistant must not provide individualized investment advice.",
"risk_category": "legal_ip_liability",
"applicability": "assistant",
"severity": "medium",
"source": "document",
"suggested": false,
"display_text": "No individualized investment advice",
"frameworks": [
"hipaa"
],
"mappings": [
{
"framework": "<string>",
"clause": "<string>"
}
]
}
],
"policy_text": "<string>",
"coc_policy_name": "<string>",
"need_explanation": true,
"block_message": "<string>"
},
"bias": {
"enabled": true
},
"sponge_attack": {
"enabled": false,
"block_message": "<string>"
}
},
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
