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

# Has prompt injection

> Learn how to use the prompt injection test

## Definition

The prompt injection test (built with [Llama](https://www.llama.com/)) checks for prompt injection, malicious strings and jailbreak attempts in the input data of your system.

## Taxonomy

* **Task types**: LLM.
* **Availability**: <Tooltip tip="Continuously evaluate your models and datasets as you iterate on their versions.">development</Tooltip>
  and <Tooltip tip="Monitor a model in production, measure its health, check for drifts and set up alerts.">monitoring</Tooltip>.

## Why it matters

* Prompt injection is a type of attack that exploits an AI system and deviates it from its intended behavior.
* It is important to detect and prevent prompt injection attacks to ensure the reliability and security of your system.

## Test configuration examples

If you are writing a `tests.json`, here are a few valid configurations for the character length test:

<CodeGroup>
  ```json Development theme={null}
  [
    {
      "name": "No prompt injection",
      "description": "Asserts that the input data has no prompt injection attempts",
      "type": "integrity",
      "subtype": "hasPromptInjectionCount",
      "thresholds": [
        {
          "insightName": "hasPromptInjectionCount",
          "measurement": "hasPromptInjectionPercentage",
          "operator": "<=",
          "value": 0.0
        }
      ],
      "subpopulationFilters": null,
      "mode": "development",
      "usesValidationDataset": true, // Apply test to the validation set
      "usesTrainingDataset": false,
      "usesMlModel": false,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689" // Some unique id
    }
  ]
  ```

  ```json Monitoring theme={null}
  [
    {
      "name": "No prompt injection",
      "description": "Asserts that the input data has no prompt injection attempts",
      "type": "integrity",
      "subtype": "hasPromptInjectionCount",
      "thresholds": [
        {
          "insightName": "hasPromptInjectionCount",
          "measurement": "hasPromptInjectionPercentage",
          "operator": "<=",
          "value": 0.0
        }
      ],
      "subpopulationFilters": null,
      "mode": "monitoring",
      "usesProductionData": true,
      "evaluationWindow": 3600, // 1 hour
      "delayWindow": 0,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689" // Some unique id
    }
  ]
  ```
</CodeGroup>
