This detector identifies and mitigates potential biases in the generated text. It helps ensure that the content is fair and unbiased across various dimensions such as gender, race, or age.

Example request:

import requests
import json
import os

url = "https://api.enkryptai.com/guardrails/detect"

payload = json.dumps({
    "text": "All programmers are men and women can't code.",
    "detectors": {
        "debias": {
            "enabled": True
        }
    }
})

headers = {
    'Content-Type': 'application/json',
    'api_key': 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)

Example response:

{
    "summary": {
        "debias": 1
    },
    "details": {
        "debias": {
            "bias_detected": true,
            "debiased_text": "People of all genders can be programmers, with skills in coding not limited to any specific gender."
        }
    }
}