> 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/alinia.md).

# Alinia

Wraps the Alinia API for content moderation and safety detection.

This wrapper allows you to send conversations or text inputs to the Alinia API. You must get an API key from Alinia and either set it to the ALINIA\_API\_KEY environment variable or pass it directly to the constructor. From Alinia, you'll also be able to get the proper endpoint URL as well.

Args: endpoint (str): The Alinia API endpoint URL. detection\_config (str | dict): The detection configuration ID or a dictionary specifying detection parameters. api\_key (str | None): The API key for authenticating with the Alinia API. If not provided, it will be read from the ALINIA\_API\_KEY environment variable. metadata (dict | None): Optional metadata to include with the request. blocked\_response (dict | None): Optional response to return if content is blocked. stream (bool): Whether to use streaming for the API response.

## Constructor

| Parameter          | Type              | Required         | Default |
| ------------------ | ----------------- | ---------------- | ------- |
| `detection_config` | \`str             | dict\[str, float | bool]   |
| `api_key`          | \`str             | None\`           | No      |
| `endpoint`         | \`str             | None\`           | No      |
| `metadata`         | \`dict\[str, Any] | None\`           | No      |
| `blocked_response` | \`dict\[str, str] | None\`           | No      |
| `stream`           | `bool`            | No               | `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 |
| ------------------- | ------------ | ------------------------ | ------- |
| `conversation`      | \`str        | list\[dict\[str, str]]\` | Yes     |
| `output`            | \`str        | None\`                   | No      |
| `context_documents` | \`list\[str] | None\`                   | No      |

**Returns:** `GuardrailOutput`


---

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