You can manage and configure keyword libraries and answer libraries in the Guardrails console to customize your content moderation policies.
Keyword library management
Create keyword libraries to flag risky content or exclude specific terms from moderation checks, and then attach these libraries to a service rule.
-
Log on to the Guardrails console.
-
In the left navigation pane, choose .
-
On the Library Management tab, click Create Library.
-
In the Create Library panel, enter the library details.
1. You can combine multiple keywords into a single logical expression. For example,
WeChat&part-timematches only when both terms appear. In an expression, the & operator must precede the ~ operator. The&operator means AND, and the~operator means NOT (exclude).2. Enter one keyword per line. Each keyword can be up to 50 characters long.
3. You can add up to 1,000 lines at a time. To add more than 1,000 lines in one batch, use Import From File.
4. You can create up to 20 libraries and add a total of 100,000 keywords per account.
-
Click OK.
If library creation fails, a detailed error message appears. Follow the instructions in the message to try again.
-
Keyword library configuration
-
In the left navigation pane, choose . Find the target service and click Set Thesaurus in the Operation column.
-
Select the Blacklist for the Library tab or Library Whitelist tab based on your needs.
-
Blacklist for the Library: Click Add a Library to add a new blacklist library. To remove a library, click Remove from Blacklist.
-
Library Whitelist: Click Add a Library to add a new whitelist library. To remove a library, click Remove from Whitelist.
Keyword blacklist
If text matches a keyword in a keyword blacklist, the Text Moderation API returns
C_customized(indicating a match in a custom library) in thelabelsparameter of the API response. Use this to detect content that violates your specific policies.For example, you add the keywords Micro-lending and in-person service to a keyword blacklist. If you submit the text "Our campus offers small loans, safe, fast, convenient, no collateral, borrow anytime, same-day funding, in-person service" for moderation, the system detects a match for both Micro-lending and in-person service. The
labelsparameter in the API response will includeC_customized, along with any labels from built-in detection rules.Keyword whitelist
If text matches a keyword in a keyword whitelist, the system ignores that keyword during moderation. Use this to prevent false positives on terms that are safe in your business context.
For example, you add the keywords convenient and fast to a keyword whitelist. If you submit the text "Our campus offers small loans, safe, fast, convenient, no collateral, borrow anytime, same-day funding, in-person service" for moderation, the system ignores convenient and fast. It then analyzes only the remaining text: "Our campus offers small loans, safe, no collateral, borrow anytime, same-day funding, in-person service".
-
-
After you add or remove a library on the Blacklist for the Library or Library Whitelist tab, click OK to save the service rule settings.
Answer library management
The Content compliance feature lets you configure a custom answer library and content based on risk labels.
-
Log on to the Guardrails console.
-
In the left navigation pane, choose .
-
On the Manage Response Template Library tab, you can add or modify answer libraries and the answers within them.
-
Click Create Answer Library and enter an answer library name. You can choose to Batch add answers, Upload file to import, or Create a library and then add answers.
-
In the answer library list, click Management in the Actions column to open the answer maintenance page for that library.
-
Click Add to use the Batch add answers feature.
-
You can add, remove, or modify answers in the answer library.
-
Answer library configuration
-
In the left navigation pane, choose .
-
On the Check Item Configuration List page, find the service you want to configure, such as AI input content security check (query_security_check), and click Management in the Actions column.
-
Select the detection type to adjust, for example, advertisement content detection.
-
Click Customize Response Template Library to enter edit mode and modify the Customize Response Template Library.
-
In the Select Response Template Library column, select an existing answer library or click Add Response Template Library to create a new one. For each label, you can configure up to three answer libraries.
-
Click Save. The new custom answer library configuration takes effect in your production environment in about one minute.
-