> ## 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.

# Content Moderation

> Use content moderation guardrails to filter inappropriate, harmful, or illegal content in LLM interactions

Content moderation is the process of reviewing and managing user-generated content on online platforms to ensure it aligns with community guidelines and legal regulations. It involves filtering, reviewing, and restricting content that violates these standards.

**Why is content moderation important?**

* Maintains a safe and positive environment for users.
* Protects against harmful or illegal content.
* Ensures compliance with regulations and builds user trust.

#### Key Areas for Validation

* **Explicit Content**: Inappropriate sexual or violent content.
* **Hate Speech**: Discriminatory language targeting individuals or groups.
* **Misinformation**: False or misleading information, especially in health and safety.
* **Illegal Content**: Instructions for illegal activities or regulatory violations.

## TrueFoundry's Content Moderation Solutions

TrueFoundry offers comprehensive content moderation through various integrations:

#### Truefoundry's Content Moderation Solutions

* [OpenAI Moderation](https://platform.openai.com/docs/guides/moderation)\
  You can use the OpenAI Moderation integration on TrueFoundry to achieve real-time analysis of text and images for harmful or inappropriate content. A brief tutorial for setting this up is provided at the end of this page.

* [AWS Bedrock Guardrails](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html)\
  You can leverage AWS Bedrock Guardrails integration on TrueFoundry to enforce pre-defined or custom content policies, enabling real-time blocking of policy violations and context-aware filtering.

* [Azure Content Safety](https://learn.microsoft.com/en-us/azure/ai-services/content-safety/overview)\
  You can use the Azure Content Safety integration on TrueFoundry to detect and mitigate harmful, unsafe, or inappropriate content in model inputs and outputs.

* [Guardrails AI (Custom Guardrail Integration)](https://hub.guardrailsai.com/)\
  You can implement custom content moderation logic using the custom guardrail integration option on TrueFoundry Gateway. As a starting point, refer to the TrueFoundry Guardrail Template Repository, which can be extended to suit your specific requirements.

<Note>
  Link to the [TrueFoundry Guardrail Template Repository](https://github.com/truefoundry/custom-guardrails-template)
</Note>

### How to set up content moderation using OpenAI Moderation on Truefoundry?

<iframe href="https://app.supademo.com/embed/cmd4dqwl84le0c4kjki3hco19" typeofembed="iframe" height="475px" width="100%" provider="app.supademo.com" src="https://app.supademo.com/embed/cmd4dqwl84le0c4kjki3hco19" style={{ border: "none", display: "flex", margin: "auto" }} />

* Get your OpenAI API key from [OpenAI](https://platform.openai.com/settings/organization/api-keys)
* Create a new or Add to an existing guardrail group on Truefoundry Gateway **(AI Gateway -> Guardrails -> Add New Guardrail Group or Add/Edit Guardrails)**
* Add OpenAI guardrail and fill the details such as:
  * Name
  * API Key
  * Base URL (optional)
  * Model (optional)
* Create a new or Edit existing guardrail configuration on Truefoundry Gateway **(AI Gateway -> Config -> Guardrail -> Create/Edit)**
* Test out the guardrail in playground **(AI Gateway -> Playground)**
