> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enkryptai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Keyword Detector

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:

<CodeGroup>
  ```python Python theme={"system"}
  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',
      'apikey': 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)
  ```

  ```python Python SDK theme={"system"}
  import os
  from enkryptai_sdk import *
  from dotenv import load_dotenv

  load_dotenv()

  ENKRYPT_API_KEY = os.getenv("ENKRYPTAI_API_KEY")
  ENKRYPT_BASE_URL = os.getenv("ENKRYPTAI_BASE_URL") or "https://api.enkryptai.com"

  guardrails_client = GuardrailsClient(api_key=ENKRYPT_API_KEY, base_url=ENKRYPT_BASE_URL)

  guardrails_config = GuardrailsConfig.keyword(keywords=["Global Enterprises", "Acme", "XYZ", "Silver Phoenix"])

  prompt = "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."

  detect_response = guardrails_client.detect(text=prompt, guardrails_config=guardrails_config)

  print(detect_response)

  # Print as a dictionary
  print(detect_response.to_dict())
  ```
</CodeGroup>

## Example response:

```json JSON theme={"system"}
{
  "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]."
    }
  }
}
```
