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.
-
bizType parameter matching — When calling the API, make sure the
bizTypeparameter is set to the string"default"or another configured string value that matches the keyword library association configured in the console. A parameter mismatch will prevent the library from taking effect. -
Policy association check — After creating a keyword library, you must add it to the corresponding service rule on the Check Item Configuration page (as a blacklist or whitelist). Creating a library alone does not automatically apply it to your moderation service.
-
Propagation delay — Keyword library configurations take effect in the production environment within approximately one minute after being saved. If the expected moderation results are not immediately reflected after configuration, wait for data synchronization to complete and then retest.
-
Library Whitelist: Click Add a Library to add a new whitelist library. To remove a library, click Remove from Whitelist.
-
Keyword format requirements — When adding keywords that contain special characters (such as URLs, email addresses, or domain names) to the whitelist, replace each special character with an ampersand (
&) before adding the keyword. For example, enter a CSDN URL asblog&csdn&net, an email domain as139&com, and a website domain asphicotek&com. -
Coordinating with check item switches — If content is still flagged as advertisement or contact information after being added to the whitelist, a specific detection switch may be enabled — for example, the URL detection or email detection switch under the
pt_to_contactlabel. In this case, go to Check Item Configuration to locate the relevant label and disable the corresponding detection switch. Alternatively, verify that the whitelist keyword format is correct and that the configuration has taken effect. -
Tokenization optimization — If false positives occur due to inaccurate tokenization, add the complete phrase (for example, "topics covered in grades 8 and 9") as a single line to your custom whitelist. Make sure the phrase contains no prohibited characters. You can also configure a similar-text library based on your business requirements.
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.Blacklist configuration notes
When a newly created blacklist does not take effect as expected, check the following:
Model fine-tuning and sample management
Blocking with negative samples — For images or text that do not exhibit obvious violation characteristics but must be blocked for business reasons, you can add negative samples in the console. This helps the model learn your specific business context and improves detection accuracy for content unique to your use case.
Feedback mechanism — If a specific
RequestIdreturns inaccurate moderation results — such as content that should be blocked passing through, or false positives — in addition to configuring keyword libraries yourself, you can submit feedback through the console. The backend will adjust the moderation strategy based on your feedback. After the adjustment takes effect, retest to verify the results.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".
Whitelist configuration notes
When configuring a keyword whitelist, pay attention to the following:
-
-
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.
-
FAQ
Can I view or export the system's built-in default keyword libraries?
The built-in default keyword libraries in AI Guardrails (including official violation libraries and blacklist dictionaries) are not publicly available. You cannot view their specific contents or export them directly. The built-in libraries are updated automatically on a regular basis, but the specific update schedule is not disclosed. If you have custom moderation requirements, go to Vocabulary Management in the console to create and maintain your own custom keyword libraries.
Why does the moderation result show no risk even though the text contains sensitive words?
Possible reasons include:
-
The word is not defined as a violation in the current moderation policy. For example, the superlative "best" used in advertising copy does not carry an inherent violation risk under advertising law.
-
Inaccurate tokenization caused the keyword to be missed.
-
A backend policy update is still propagating.
To block such content, create a custom keyword blacklist on the Vocabulary Management page in the console, add the relevant keywords (for example, "best", "spamming", or "grinding XP"), and make sure the library is associated with the moderation policy you are currently using. Note that moderation results may take a short time to synchronize after configuration. Wait briefly and then retest.
How do I block spam or meaningless content that does not violate content policies?
Content Moderation's default policy primarily detects pornographic, politically sensitive, and abusive content. Comments such as spam or engagement farming are generally not blocked automatically. To block such content, configure a custom text library on the Vocabulary Management page in the console, add common spam phrases to the keyword or similar-text blacklist, and set the detection result to Risk List or Suspected List.