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

# Guardrails

> An introduction to the Qualifire protection guardrails

Qualifire provides a set of protection guardrails that can be used to enforce specific policies and standards in your content. These guardrails can be applied to your content, ensuring that it meets the required criteria.

## Creating a Guardrail

To create a new guardrail, follow these steps:

<Steps>
  <Step title="Navigate to the Guardrails page in the Qualifire platform.">
    By clicking on the "Guardrails" tab in the Qualifire platform, you can
    access the Guardrails page where you can create, manage, and monitor your
    guardrails.
  </Step>

  <Step title="Click on the 'New Guardrail' button.">
    Once you are in the Guardrails page, click on the 'Create New Guardrail'
    button to create a new guardrail.
  </Step>

  <Step title="Configure the guardrail to your specific needs.">
    You can customize the guardrail to your specific needs by setting the
    conditions, actions, and other parameters.
  </Step>

  <Step title="Save the guardrail and start monitoring your content.">
    Once you have configured the guardrail, click on the 'Save' button to save
    the guardrail. You can now start monitoring your content to ensure it meets
    the required criteria.
  </Step>
</Steps>

## Using Guardrails via SDK

<CodeGroup>
  ```javascript Node.js theme={null}
  import OpenAI from "openai";

  const openai = new OpenAI({
    apiKey: process.env.OPENAI_API_KEY,
    baseURL: "https://proxy.qualifire.ai/api/providers/openai",
    defaultHeaders: {
      "X-Qualifire-Api-Key": process.env.QUALIFIRE_API_KEY,
    },
  });

  const response = await openai.chat.completions.create({
    model: "gpt-4o",
    messages: [{ role: "user", content: "Hello, how are you?" }],
  });
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["OPENAI_API_KEY"],
      base_url="https://proxy.qualifire.ai/api/providers/openai",
      default_headers={
          "X-Qualifire-Api-Key": os.environ["QUALIFIRE_API_KEY"],
      },
  )

  response = client.chat.completions.create(
      model="gpt-4o",
      messages=[{"role": "user", "content": "Hello, how are you?"}],
  )
  ```
</CodeGroup>

<Warning>
  Guardrails that fail will block the response from reaching your users. Make sure to test your guardrail configuration thoroughly before deploying to production.
</Warning>

## Guardrail Categories

<AccordionGroup>
  <Accordion title="Security Guardrails" icon="shield-check">
    Protect against prompt injection attacks and prevent PII exposure. These guardrails run on input and output to catch threats at every stage.
  </Accordion>

  <Accordion title="Safety Guardrails" icon="shield-exclamation">
    Filter harmful content including dangerous material, harassment, hate speech, and sexually explicit content.
  </Accordion>

  <Accordion title="Reliability Guardrails" icon="magnifying-glass">
    Ensure outputs are accurate and grounded. Includes hallucination detection, context grounding, and tool selection quality checks.
  </Accordion>

  <Accordion title="Policy Guardrails" icon="gavel">
    Enforce custom business rules using natural language assertions. Define any policy and have it consistently applied to every response.
  </Accordion>
</AccordionGroup>

## Managing Guardrails

Once you have created a guardrail, you can manage it through the Guardrails page. You can edit, duplicate, or delete guardrails as needed.

## Monitoring Guardrails

Qualifire provides a detailed view of the guardrail's application to your content. You can see the results of the guardrail's checks, the severity level, and any issues or failed checks that were identified.

You can also access the raw data and explore a feature that suggests better prompts.

<CardGroup cols={2}>
  <Card title="Evaluations" icon="magnifying-glass" href="/essentials/evaluations">
    Learn about the evaluation checks that power guardrails
  </Card>

  <Card title="Notifiers" icon="bell" href="/essentials/notifiers">
    Set up alerts when guardrails are triggered
  </Card>
</CardGroup>
