# Moderation

The "Moderation" screen, divided into "Rule Sets" and "Rules," is designed to protect, hide, and block data. It also includes information masking modes, clarification, and data correction within the model.

The "Rule Sets" section displays groups of related rules, while the "Rules" section shows specific settings or instructions that belong to these groups.

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-97993aa9e45064f249043ce8655b0d35856376c2%2Fimage%20(25).png?alt=media" alt=""><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="51.333251953125"></th><th></th><th valign="top"></th></tr></thead><tbody><tr><td><strong>No.</strong></td><td><strong>Interface Element</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td></td><td><strong>Rule Sets Table</strong></td><td valign="top"></td></tr><tr><td>1.</td><td>“Create” button</td><td valign="top">Allows creating a new rule set.</td></tr><tr><td>2.</td><td>“Refresh” button</td><td valign="top">Forces a refresh of the "Rule Sets" table.</td></tr><tr><td>3.</td><td>“Duplicate” button</td><td valign="top">Allows duplicating a previously created rule set.</td></tr><tr><td>4.</td><td>“Delete Selected” button</td><td valign="top">Allows deleting selected rule sets from the Sherpa AI Server. Individual rule sets can also be deleted by clicking the button in the corresponding row of the "Rule Sets" table. A confirmation window appears when deleting a rule set.</td></tr><tr><td>5.</td><td>“Export to CSV” button</td><td valign="top">Generates a data file of rule sets in CSV format for import into spreadsheets and accounting systems.</td></tr><tr><td>6.</td><td>“Export to XLSX” button</td><td valign="top">Generates a data file of rule sets in Microsoft Excel (XLSX) format for import into spreadsheets and accounting systems.</td></tr><tr><td>7.</td><td>“Active” column</td><td valign="top">Date and time of the last change to the access folder.</td></tr><tr><td>8.</td><td>“Name” column</td><td valign="top">Name of the rule set.</td></tr><tr><td>9.</td><td>“Description” column</td><td valign="top">Text description of the rule set.</td></tr><tr><td>10.</td><td>“Rule Application Mode” column</td><td valign="top"><p>The order of processing multiple triggered rules for a single object.</p><p>Value options:</p><ol><li>Apply only the first triggered rule: Processing stops after the first rule (priority by order in the list).</li><li>Apply all triggered rules: All rules that meet the conditions are processed sequentially (cascading execution).</li></ol></td></tr><tr><td>11.</td><td>“Created” column</td><td valign="top">Date and time of the rule set creation.</td></tr><tr><td>12.</td><td>“Modified” column</td><td valign="top">Date and time of the last modification of the rule set.</td></tr><tr><td></td><td><strong>Rules Table</strong></td><td valign="top"></td></tr><tr><td>1.</td><td>“Create” button</td><td valign="top">Allows creating a new rule.</td></tr><tr><td>2.</td><td>“Refresh” button</td><td valign="top">Forces a refresh of the "Rules" table.</td></tr><tr><td>3.</td><td>“Delete Selected” button</td><td valign="top">Allows deleting selected rules from the Sherpa AI Server. Individual rules can also be deleted by clicking the button in the corresponding row of the "Rules" table. A confirmation window appears when deleting a rule.</td></tr><tr><td>4.</td><td>“Export to CSV” button</td><td valign="top">Generates a data file of the rule in CSV format for import into spreadsheets and accounting systems.</td></tr><tr><td>5.</td><td>“Export to XLSX” button</td><td valign="top">Generates a data file of the rule in Microsoft Excel (XLSX) format for import into spreadsheets and accounting systems.</td></tr><tr><td>6.</td><td>“Active” column</td><td valign="top">Indicates whether the rule is applied.</td></tr><tr><td>7.</td><td>“Name” column</td><td valign="top">Name of the rule.</td></tr><tr><td>8.</td><td>“Description” column</td><td valign="top">Text description of the rule.</td></tr><tr><td>9.</td><td>“Trigger Type” column</td><td valign="top">Conditions under which this rule is triggered.</td></tr><tr><td>10.</td><td>“Actions” column</td><td valign="top">Processing modes for the triggered rule (masking, rewriting, redirecting, notifying, fixed response).</td></tr><tr><td>11.</td><td>“Created” column</td><td valign="top">Date and time of rule creation.</td></tr><tr><td>12.</td><td>“Modified” column</td><td valign="top">Date and time of the last modification of the rule.</td></tr></tbody></table>

## Create Rule Set

To create a new rule set, click the "Create" button in the "Rule Sets" table and fill out the form that appears.

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-467a6acfde26a72d8b4a6b9207d99ffff331f16d%2Fimage%20(22).png?alt=media" alt=""><figcaption></figcaption></figure>

* **Name \*** — the name of the rule set.
* **Description** — description of the rule set.
* **Rule Application Mode \*** — a dropdown list that defines the order of processing multiple triggered rules for a single object. Value options:
  * **Apply only the first triggered rule**: Processing stops after the first rule (priority by order in the list).
  * **Apply all triggered rules**: All rules that meet the conditions are processed sequentially (cascading execution).

## Create Rule

To create a new rule, click the “Create” button in the "Rules" table and fill out the form that appears.

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-de80006bf8776756c1a68f391dbbe4a396917579%2Fimage%20(23).png?alt=media" alt=""><figcaption></figcaption></figure>

* **Name \*** – a required field for entering the name of the rule.
* **Description** – a field for entering the description of the rule.

### Trigger

* **Trigger Type \*** – a required field with a dropdown list for selecting the condition under which this rule is triggered. Possible values:

#### **Dictionary**

**Dictionary** – a set of specific phrases or words used for recognizing and processing incoming data.

* **Word List** – a field for entering phrases and words included in the dictionary. Each phrase or word is placed on a separate line (all words must be listed one per line).

#### **Regular Expression**

**Regular Expression** – special characters that allow describing specific patterns or templates to search for in the text.

* **List of Regular Expressions** – a field for entering regular expressions that the request will be checked against. Only one regular expression should be in each line of the list.

#### **Local Model**

**Local Model** – a trigger used for the rule to activate when using a specific instance of the model. All necessary parameters are set within the configuration: model, prompt, Regex for response validation, and temperature.

* **Model** – a field for selecting the AI model for generating or processing the response;
* **Prompt** – a template for the request to the AI model;
* **Regexp for response validation** – a regular expression for validating the model's response;
* **Temperature** – a numerical parameter for model generation (from 0 to 1) that affects the creativity of the response.

#### **External Service**

**External Service** – a URL used when calling a specific external API at the specified URL. When it is necessary to initiate an event or obtain information, the system sends a request to the specified URL of the external service.

* **External Service URL** – the address of the external API or service for data moderation.

### Actions

**Actions** – processing modes for the triggered rule (masking, rewriting, redirecting, notifying, fixed response).

#### **Block**

**Block** – an action that, when selected, will block the message, and the neural network will respond with a simple error notification.

#### **Masking**

**Masking** – an action for hiding data. If it is necessary to replace or hide specific words, they are obscured in the response (and also obscured in the request). This is especially important for the moderation function to prevent the leakage of sensitive information from the company's internal network to the external neural network service.

* **Replacement Text** – a single-line text field that specifies the string to replace sensitive words.

#### **Rewrite**

**Rewrite** – an action that allows sending an additional request to the internal model with a specific prompt, aimed at rephrasing or replacing unwanted words. This approach helps avoid the use of undesirable content without blocking or deleting the original message.

* **Model** – a dropdown list for selecting the internal AI model for rephrasing.
* **Prompt** – a multi-line field representing a template instruction for rewriting the request.
* **Temperature** – a numerical field (from 0 to 1) assessing the level of creativity in generation.

#### **Redirect**

**Redirect** – an action that allows sending a request to another model or service, enabling flexible data processing management.

* **Model** – a dropdown list for selecting the internal AI model for redirecting the request.

#### **Notify**

**Notify** – an action that allows the system not to block the message itself but simply to log the fact of the request, sending a corresponding notification to the administrator. Logs or audits retain information that the User asked a question containing inappropriate or sensitive content, helping the security service respond promptly.

#### **Fixed Response**

**Fixed Response** – an action that allows the User to receive a pre-defined response without contacting an external neural network. Such a response can serve as a notification of an error or restrictions (e.g., regarding unacceptable words or expressions). It can be expanded by adding a more informative explanation in the message about what is specifically unacceptable in the system.

* **Fixed Response** – a multi-line text field allowing the entry of a prepared response text.

### Test Text

To check whether the selected action is functioning correctly, you can use the "Test Text" field. Enter text into it and click the "Run Test" button.

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-db08e8761ac27f6e1c979a9761c42a0e2ce0a5d2%2Fimage%20(277).png?alt=media" alt=""><figcaption></figcaption></figure>

### Edit Rule Set

To view and edit the properties of a specific rule set, select it from the list and click the button ![](https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-8f5f4782ac14b216a277cbb1648ebc6acd50acf1%2Fimage%20\(70\).png?alt=media). After that, a form with the settings of the rule set will open, where you can make the necessary changes. There are no new fields in the previously created rule set.

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-2f29a995e6abacc638d357da3bfe523d273b1ce8%2Fimage%20(24).png?alt=media" alt=""><figcaption></figcaption></figure>

### Edit Rule

To view and edit the properties of a specific rule, select it from the list and click the button ![](https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-8f5f4782ac14b216a277cbb1648ebc6acd50acf1%2Fimage%20\(70\).png?alt=media). After that, a form with the settings of the rule will open, where you can make the necessary changes. There are no new fields in the previously created rule.

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-08e7bd22160833bacac3b955baea58eef22a32d2%2F2025-08-06_22-55-48.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://docs.sherparpa.ru/en/sherpa-ai/sherpa-ai-server/rabota-v-sherpa-ai-server/moderaciya.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
