> For the complete documentation index, see [llms.txt](https://docs.mozilla.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mozilla.ai/any-guardrail/api-reference/index/content-safety/alinia.md).

# Alinia

Hosted content-moderation and safety-detection API with configurable detection policies.

Sends a text input or a full conversation to the Alinia API, which runs whichever detections you enable via `detection_config` (e.g. `{"security": True}` for prompt-injection / data-exfiltration detection, plus safety, compliance, and hallucination policies) and reports per-category verdicts. Alinia's detection models are multilingual (its security model is trained on English, Spanish, and Catalan).

Verdict mapping: `valid` is `True` when Alinia does not flag the input. `categories` flattens Alinia's nested `category_details` into one entry per `group/label` — boolean details become `triggered` flags, numeric details become per-category `score` values. The top-level `score` is the highest numeric category score (higher = riskier), or `None` when the endpoint returns only booleans. `explanation` carries the recommendation text when the endpoint returns one (e.g. sensitive information), `action` carries a structured recommendation's action (e.g. `"block"`), and `raw` is the full response JSON.

Expected inputs: `validate` accepts either a plain string or a list of chat-message dicts (`{"role": ..., "content": ...}`), plus an optional model `output` and optional `context_documents` for detections that evaluate responses in context.

You must obtain an API key and the endpoint URL from Alinia, and pass them either directly to the constructor or via the `ALINIA_API_KEY` / `ALINIA_ENDPOINT` environment variables.

For more information, see:

* [Alinia AI](https://alinia.ai/) (vendor site).
* [Integrating Alinia into any-guardrail](https://blog.mozilla.ai/integrating-alinia-into-any-guardrail-for-multilingual-ai-security/) (Mozilla AI blog walkthrough of this guardrail).

## Constructor

| Parameter          | Type              | Required         | Default | Description                                                       |
| ------------------ | ----------------- | ---------------- | ------- | ----------------------------------------------------------------- |
| `detection_config` | \`str             | dict\[str, float | bool]   | dict\[str, dict\[str, float                                       |
| `api_key`          | \`str             | None\`           | No      | `None`                                                            |
| `endpoint`         | \`str             | None\`           | No      | `None`                                                            |
| `metadata`         | \`dict\[str, Any] | None\`           | No      | `None`                                                            |
| `blocked_response` | \`dict\[str, str] | None\`           | No      | `None`                                                            |
| `stream`           | `bool`            | No               | `False` | Whether to request a streaming API response. Defaults to `False`. |

Initialize the Alinia guardrail with the provided configuration.

## validate

Validate conversation or text input using the Alinia API.

This can be used for validation using any of the API endpoints provided by Alinia.

**Parameters**

| Parameter           | Type         | Required                 | Default | Description |
| ------------------- | ------------ | ------------------------ | ------- | ----------- |
| `conversation`      | \`str        | list\[dict\[str, str]]\` | Yes     | —           |
| `output`            | \`str        | None\`                   | No      | `None`      |
| `context_documents` | \`list\[str] | None\`                   | No      | `None`      |

**Returns:** `GuardrailOutput`

## Benchmarks

No benchmark results recorded yet. See the [benchmark methodology](/any-guardrail/api-reference/benchmarks.md) for how numbers are harvested (published) or measured and added.

## License

* **Vendor:** Alinia AI
* **Default license:** `proprietary` (of the default model/service)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mozilla.ai/any-guardrail/api-reference/index/content-safety/alinia.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
