Moderation#

The Moderation screen is designed to manage sets of rules and individual Moderation rules that are applied to check or process messages in Sherpa AI Server.

No.Interface ElementDescription
1.“Rule Sets” blockDesigned to manage Moderation rule sets.
1.1.“Create” buttonOpens the form to create a new rule set.
1.2.“Refresh” buttonRefreshes the list of rule sets.
1.3.“Duplicate” buttonAllows creating a copy of the selected rule set.
1.4.“Delete Selected” buttonAllows deleting selected rule sets.
1.5.“Export to CSV” buttonExports the list of rule sets to a CSV file.
1.6.“Export to XLSX” buttonExports the list of rule sets to an XLSX file.
1.7.“Active” columnShows whether the rule set is enabled.
1.8.“Name” columnDisplays the name of the rule set.
1.9.“Description” columnDisplays the description of the rule set, if specified.
1.10.“Application Mode” columnDisplays the application mode of the rule set.
1.11.“Created” columnDisplays the date and time the rule set was created.
1.12.“Modified” columnDisplays the date and time the rule set was last modified.
1.13.Edit button Allows opening the selected rule set for editing.
1.14.Delete button Allows deleting a specific rule set.
2.“Rules” blockThe lower area of the screen designed to manage individual Moderation rules.
2.1.“Create” buttonOpens the form to create a new rule.
2.2.“Refresh” buttonRefreshes the list of rules.
2.3.“Delete Selected” buttonAllows deleting selected rules.
2.4.“Export to CSV” buttonExports the list of rules to a CSV file.
2.5.“Export to XLSX” buttonExports the list of rules to an XLSX file.
2.6.“Active” columnShows whether the rule is enabled.
2.7.“Name” columnDisplays the name of the rule.
2.8.“Description” columnDisplays the description of the rule, if specified.
2.9.“Trigger Type” columnDisplays the type of condition that triggers the rule.
2.10.“Actions” columnDisplays the action performed when the rule is triggered.
2.11.“Created” columnDisplays the date and time the rule was created.
2.12.“Modified” columnDisplays the date and time the rule was last modified.
2.13.Edit button Allows opening the selected rule for editing.
2.14.Delete button Allows deleting a specific rule.
2.15.Row count selection Allows specifying how many records will be displayed in the table on one page.
2.16.Record counter Shows the range of records displayed on the current page and the total number of records in the table.
2.17.Page navigation Allows navigating between pages of the table: to the first page, to the previous page, to the next page, or to the last page. Also displays the current page number and the total number of pages, for example Page 1 of 1.

Create Rule Set#

To create a new rule set, you need to click the “Create” button in the “Rule Sets” section and fill out the opened form.

  • Name * — the name of the rule set.
  • Description — the description of the rule set.
  • Rule Application Mode * — a dropdown list that determines 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, you need to click the “Create” button in the “Rules” section and fill out the opened form.

No.Interface ElementDescription
1.field "Name"

Required field for entering the rule name.

If the field is not filled, it is highlighted in red, and the "OK" button remains inactive.

2.field "Description"Intended for entering a brief description of the Moderation rule.
3.block "Trigger"Contains settings for the condition under which the rule should be triggered.
3.1.field "Trigger Type"

Required dropdown field where the method for checking the user message is selected.

The selected Trigger type determines the condition under which the Moderation rule will be triggered and which additional fields will appear in the rule settings form:

  • value "Dictionary" - the rule is triggered if one of the words specified in the word list is found in the User's message. Suitable for simple checks based on predefined words or phrases.
  • value "Regular Expression" - the rule is triggered if the User's message matches the specified regular expression. Used for more flexible text pattern checks, such as formats of numbers, addresses, or stable text constructions.
  • value "Local Model" - the rule is triggered based on checking the message with a local Model. This option is used when a simple word list or regular expression is insufficient and a model assessment of the text content is required.
  • value "External Service" - the rule is triggered based on checking the message through an external service. Used when Moderation requires connecting a third-party system or external API.
3.2.field "Word List"Intended for entering words whose presence will be checked in the User's request.
3.3.hint for the word list

Explains that:

  • the User's request is checked for the presence of the specified words;
  • only one word should be in each line of the list;
  • the check is case-insensitive;
  • the rule is triggered if any word from the list is found in the User's message.
4.block "Actions"Contains actions that the system will perform when the rule is triggered.
4.1.field "Action Type"

Required dropdown field where the action performed by the system when the Moderation rule is triggered is selected.

The selected action type determines what will happen to the User's message or the system's response after the specified Trigger is detected:

  • value "Block" - blocks the processing of the message or the execution of the further scenario when the rule is triggered. Used when the message should not be passed further or should be stopped.
  • value "Masking" - replaces found text fragments with hidden or anonymized values. Suitable for processing personal data, secrets, tokens, document numbers, and other sensitive information.
  • value "Rewrite" - modifies the text of the message according to specified rules before further processing. Used when it is necessary to automatically rephrase or clean the message.
  • value "Redirect" - redirects the processing of the message to another scenario, route, or handler. Applied when the request should be passed to another process upon triggering the rule.
  • value "Notification" - generates a notification when the rule is triggered. Used when it is necessary to record an event and inform the responsible user or system about it.
  • value "Fixed Response" - returns a predefined response instead of the standard message processing. Suitable for cases where template text is needed to respond to certain requests.
4.2.button to delete action Allows deleting the added action from the rule.
4.3.button Allows adding another action that will be performed when the rule is triggered.
5.field "Test Text"Intended for entering text on which the rule can be tested before saving.
6.button "Run Test"Starts the rule check on the entered test text.

If the button is inactive, the necessary data for testing is not filled in.
7.button "Cancel"Closes the window without creating a rule and without saving the entered data.
8.button "OK"Creates a rule with the specified parameters.

Active only if all required fields are completely filled.

Edit Rule Set#

To view and edit the properties of a specific rule set, you need to select it from the list and click the button . After that, a form with the rule set settings will open, where you can make the necessary changes. There are no new fields in the previously created rule set.

Edit Rule#

To view and edit the properties of a specific rule, you need to select it from the list and click the button . After that, a form with the rule settings will open, where you can make the necessary changes. There are no new fields in the previously created rule.

Check Saved Set in Assistant#

The "Run Test" button checks only the current rule in the form. To verify that the rule set works in Chat, check it through a test Assistant.

For testing, create a separate test rule set:

  1. Select the "Apply only the first triggered rule" application mode.
  2. Create an active rule in the set with the "Dictionary" Trigger.
  3. In the word list, enter secret.
  4. In the action, select "Fixed Response" and set the response text to Moderation Check.
  5. Save the rule by clicking "OK".
  6. Open the test Assistant settings.
  7. In the "Moderator" field, select the created set and save the Assistant.
  8. Open Chat with this Assistant and send the message secret.

If everything is configured correctly, the Assistant will reply: Moderation Check.

Reload the page and open the same dialog: the fixed response should remain in the history.

You can also check that the rule really turns on and off:

  • send a regular message without the word secret — the Assistant should reply as usual;
  • disable the rule and send secret again — the fixed response should not appear;
  • disable the entire rule set — the rules in it should also stop applying.

If the check fails:

  1. If the rule passes the "Run Test" check but Chat returns an error, report the system version, error time, and the test set ID to the administrator. The administrator will check the logs and whether a fix is available for your version.
  2. If the set contains multiple rules, check the trigger order (numeric priority). In "Apply only the first triggered rule" mode, the rule with the lower numeric priority runs first. Inactive and deleted rules, as well as rules from other sets, should not be applied. After testing, restore the test Assistant settings and delete the test set.
  3. If a rule with the "Local Model" trigger type hangs, test it separately. A successful connection check and the list of Models confirm only endpoint availability, not generation speed. Give the administrator the error time, model name, and a short anonymized request example. The administrator will check generation, the queue, and the LLM server logs. Do not disable moderation protection on the working Assistant just to bypass the error.
  4. If the test shows blocked and a fixed response is set, but the response does not appear in Chat or is replaced by the Model response, provide the administrator with the system version and an anonymized request example. The "Block" action without fixed text stops message processing but does not add an empty response. The "Masking" action changes the input text and then passes it to the Assistant for normal processing.
  5. Editing a blocked message in history does not reprocess it. To continue the conversation, send a new message that passes the Moderation rules.