This detector is designed to scan text for specific words or phrases that are predefined as significant, sensitive, or requiring special attention, such as banned or proprietary terms. In the provided output, you can expect to see which keywords were detected, the count of each keyword’s occurrence, and a version of the text with the detected keywords redacted to maintain confidentiality or compliance.

Example request:

import requests
import json
import os

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

payload = json.dumps({
    "text": "During the strategic meeting, discussions about the partnership between Silver Phoenix and XYZ were highly detailed, revealing insights about their joint venture and its impact on Global Enterprises.",
    "detectors": {
        "keyword_detector": {
            "enabled": True,
            "banned_keywords": ["Global Enterprises", "Acme", "XYZ", "Silver Phoenix"]
        }
    }
})

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": {
    "keyword_detected": 3
  },
  "details": {
    "keyword_detector": {
      "detected_keywords": ["Global Enterprises", "XYZ", "Silver Phoenix"],
      "detected_counts": {
        "Global Enterprises": 1,
        "XYZ": 1,
        "Silver Phoenix": 1
      },
      "redacted_text": "During the strategic meeting, discussions about the partnership between [KEYWORD_3] and [KEYWORD_2] were highly detailed, revealing insights about their joint venture and its impact on [KEYWORD_1]."
    }
  }
}