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

# Topic Filtering

> Learn how to implement topic filtering guardrails in TrueFoundry AI Gateway to validate and filter content based on specific topics.

Validates that content does not contain certain topics.

## Options:

* **denied\_topics**: An array of topics to disallow, e.g., \["medical advice", "profanity"]
* **threshold**: Float between 0-1, describes how sensitive should the classifier be. A higher threshold means, the content has to be highly related with the topic for the guardrail to fail the request.

## Example

<CodeGroup>
  ```yaml YAML lines theme={"dark"}
  name: content-filter-guardrails
  type: content-filter-guardrails-config
  rules:
    - id: content-standard-enforcement
      when:
        models:
          - openai-main/gpt-3-5-turbo
      input_guardrails:
        - type: topics
          action: validate
          options:
            threshold: 0.8
            denied_topics:
              - medical advice
              - profanity
      output_guardrails:
        - type: topics
          action: validate
          options:
            threshold: 0.9
            denied_topics:
              - medical advice
              - profanity
  guardrails_service_url: https://content-filter-service.company.com
  ```
</CodeGroup>
