Queries the custom text libraries in your Content Moderation account. The results are consistent with the custom text libraries shown in the AI Guardrails console.
Usage notes
API operation: DescribeKeywordLib
To construct an HTTP request manually, see Request structure. To call this operation using a pre-built client, see SDK overview.
Billing: Free.
QPS limits
This operation is limited to 10 requests per second per account. Requests that exceed this limit are throttled.
Request parameters
For common request parameters, see Common parameters.
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| ServiceModule | String | Yes | open_api | The feature module of the text library. Set to open_api to query libraries used by the AI Guardrails API. |
Response elements
For top-level response fields, see Response parameters.
The KeywordLibList field in the response body is an array. Each element contains the following fields:
| Name | Type | Example | Description |
|---|---|---|---|
| Id | Integer | 2147 | The ID of the text library. |
| ModifiedTime | String | 2018-09-04 14:17:56 +0800 | The time when the text library was last modified. |
| Name | String | test1sdkdk | The name of the text library. |
| Code | String | 710001 | The code of the text library. In the AI Guardrails console, the code appears on the Machine Review > Threat Detection Library page. In API operations, use Id to identify a text library, not Code. |
| Count | String | 3 | The number of text entries in the text library. |
| Category | String | BLACK | The category of the text library. Valid values: BLACK, WHITE, REVIEW. See the table below. |
| Source | String | MANUAL | The source of the text library. Valid values: MANUAL (manually created), FEEDBACK (automatically created by AI Guardrails). |
| BizTypes | StringArray | ["bizTypeA","bizTypeB"] | The business scenarios associated with the text library. For details, see Create a business scenario. |
| ResourceType | String | TEXT | The resource type of the library. Valid values: TEXT (text library), IMAGE (image library), VOICE (voice library). |
| LibType | String | textKeyword | The library type within each detection scenario. Valid values vary by scenario. See the table below. |
| MatchMode | String | fuzzy | The match mode for text detection. Valid values: fuzzy (fuzzy match), precise (exact match). |
| Enable | Boolean | true | The status of the text library. Valid values: true (enabled), false (disabled). To re-enable a disabled library, call the create text library operation. For more information, see Modify a text library. |
Category values
| Value | Behavior when a match is found |
|---|---|
| BLACK | The detected text is flagged as spam. Delete or restrict the content. |
| WHITE | The detected text is considered normal. Pass the content directly. |
| REVIEW | The detected text requires manual review. |
LibType values by scenario
| Detection scenario | LibType value | Description |
|---|---|---|
| Text spam detection | textKeyword | Keyword library |
| Text spam detection | similarText | Similar text library |
| Image advertising | textKeyword | Image keyword library |
| Voice spam detection | voiceText | Voice keyword library |
Examples
Request example
http(s)://green.cn-shanghai.aliyuncs.com/?Action=DescribeKeywordLib&ServiceModule=open_api&<Common request parameters>Response example
{
"requestId": "795D8871-4889-4C0F-A8B1-C7D2B990FF61",
"data": {
"TotalCount": 11,
"KeywordLibList": [
{
"Name": "test1sdkdk",
"Source": "MANUAL",
"BizTypes": [],
"Category": "BLACK",
"ServiceModule": "open_api",
"Count": 3,
"ResourceType": "TEXT",
"Id": 2147,
"ModifiedTime": "2018-09-04 14:17:56 +0800",
"Code": "710001",
"LibType": "textKeyword",
"MatchMode": "fuzzy",
"Enable": "true"
},
{
"Name": "Test001",
"Source": "MANUAL",
"BizTypes": [],
"Category": "BLACK",
"ServiceModule": "open_api",
"Count": 3,
"ResourceType": "VOICE",
"Id": 2693,
"ModifiedTime": "2018-09-03 17:11:04 +0800",
"Code": "932001",
"LibType": "voiceText",
"MatchMode": "fuzzy",
"Enable": "true"
}
]
},
"code": 200,
"success": true
}