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

# Toxicity

> Toxicity assesses the content for harmful or toxic language. This evaluation is crucial for ensuring that content does not contain language that could be offensive, abusive, or harmful to individuals or groups.

<CodeGroup>
  ```python Python theme={null}
  result = evaluator.evaluate(
      eval_templates="toxicity",
      inputs={
          "output": "Dear Sir, I hope this email finds you well. I look forward to any insights or advice you might have whenever you have a free moment"
      },
      model_name="turing_flash"
  )

  print(result.eval_results[0].output)
  print(result.eval_results[0].reason)
  ```

  ```typescript JS/TS theme={null}
  import { Evaluator, Templates } from "@future-agi/ai-evaluation";

  const evaluator = new Evaluator();

  const result = await evaluator.evaluate(
    "toxicity",
    {
      output: "Dear Sir, I hope this email finds you well. I look forward to any insights or advice you might have whenever you have a free moment"
    },
    {
      modelName: "turing_flash",
    }
  );

  console.log(result);
  ```
</CodeGroup>

| **Input** |                    |          |                                   |
| --------- | ------------------ | -------- | --------------------------------- |
|           | **Required Input** | **Type** | **Description**                   |
|           | `output`           | `string` | Content to evaluate for toxicity. |

| **Output** |            |                                                                                                             |
| ---------- | ---------- | ----------------------------------------------------------------------------------------------------------- |
|            | **Field**  | **Description**                                                                                             |
|            | **Result** | Returns Passed if no toxicity is detected, or Failed if toxicity is detected.                               |
|            | **Reason** | Provides a detailed explanation of why the content was classified as containing or not containing toxicity. |

***

### What to do when Toxicity is Detected

If toxicity is detected in your response, the first step is to remove or rephrase harmful language to ensure the text remains safe and appropriate. Implementing content moderation policies can help prevent the dissemination of toxic language by enforcing guidelines for acceptable communication.

Additionally, enhancing toxicity detection mechanisms can improve accuracy, reducing false positives while ensuring that genuinely harmful content is effectively identified and addressed.

***

### Comparing Toxicity with Similar Evals

1. [**Content Moderation**](/future-agi/get-started/evaluation/builtin-evals/content-moderation): It focuses on assessing text for overall safety and appropriateness, identifying harmful or offensive content across various categories. In contrast, **Toxicity Evaluation** specifically targets the detection of toxic language, such as hate speech, threats, or highly inflammatory remarks.
2. [**Tone Analysis**](/future-agi/get-started/evaluation/builtin-evals/tone): It evaluates the emotional tone and sentiment of the text, determining whether it is neutral, positive, or negative. While it provides insights into how a message may be perceived, **Toxicity Evaluation** is more concerned with identifying language that is explicitly harmful or offensive, regardless of sentiment.
