Rule object
This topic describes the structure of a rule object.
To create your object structure, perform the desired actions in the UI and inspect the request parameters with your browser's developer tools. You can use the captured data as a template.
Rule types
Rules are divided into two categories: standard quality inspection rules and large model quality inspection rules.
Rule configuration
The quality inspection rule system is divided into three levels: rule, condition, and operator. For the definition of each term, see Term Definitions.
A rule contains multiple conditions, and each condition corresponds to an operator.
For more information about detection operators, see Detection operator object reference.
RulesInfo
The RulesInfo object contains a collection of rule information. This structure is used in API operations such as getRuleById.
Object structure
Parameters
'data' attribute
Attribute | Type | Example | Description |
conditions | Array | [] | The configuration for all conditions. For details, see the |
rules | Array | [] | The configuration for all rules. For details, see the |
'conditions' attribute
Attribute | Type | Example | Description |
cid | String | "a" | The alphabetical ID of the condition, used for display in the UI. |
id | Long | 1233 | The unique ID of the condition. |
rid | String | "232" | The ID of the rule that this condition belongs to. |
check_range | Struct | For details, see the
| The scope of the condition. |
operators | List | For details, see the
| The operators that the condition contains. |
lambda | String | "1222" | The logical relationship between the operators in the condition. |
CheckRange object
Attribute | Type | Example | Description |
role | String | customer service agent | The applicable role. Valid values: |
anchor | Anchor | For details, see the
| The details of the precondition. |
range | String | {"from": 1, "to": 3} | The detection range. |
Anchor object (precondition)
Attribute | Type | Example | Description |
cid | String | "a" | The ID ( |
location | String | AROUND | Specifies the location to check relative to the utterance where the precondition is met. This field works with the |
hit_time | Integer | 3 | Specifies which precondition match instance triggers the current condition. A positive integer |
OperatorBasicInfo object
Attribute | Type | Example | Description |
oid | String | "1222" | The ID of the operator. |
name | String | Sample Operator Name | The name or description of the operator. |
type | String | INCLUDE_KEYWORDS | The type of the operator. For details, see Create a rule. |
param | Param | The parameters of the operator expression. For details, see Create a rule. |
'rules' attribute
Attribute | Type | Example | Description |
rid | String | 1 | The ID of the rule. |
lambda | String | a&&b&&c | The logical relationship between conditions in the rule. |
business | List | For details, see the
| The applicable business categories. |
type | Integer | 1 | The type of the rule. |
triggers | List | ["a","b","c"] | An array of condition IDs ( |
name | String | "Potential customer complaint" | The name of the rule. |
scoreSubId | Integer | 3678 | The ID of the associated scoring sub-item. |
ruleScoreType | Integer | 3 | Specifies if the associated item is scored when this rule is met. Valid values: |
level | Integer | 2 | The severity level of the rule violation. Valid values:
|
fullCycle | Integer | 1 | Specifies when the rule is effective. Valid values:
|
effectiveStartTime | Date | 1640620800000 | The start time of the effective period. This parameter is valid only when |
effectiveEndTime | Date | 1640620800000 | The end time of the effective period. This parameter is valid only when |
autoReview | Integer | 1 | Specifies if automatic review is enabled. Valid values: |
comments | String | Checks for forbidden words. | Notes for the rule. |
qualityCheckType | Integer | 0 | Specifies whether the rule is for real-time quality inspection. Valid values: |
BusinessCategoryBasicInfo object
Attribute | Type | Example | Description |
bid | Long | 574599480 | The business category ID. |
name | String | Pre-sales | The name of the business category. |
Rule example
{
"data": {
"conditions": [
{
"check_range": {},
"cid": "a",
"id": 92495,
"lambda": "93289",
"operators": [
{
"id": 93289,
"oid": "93289",
"param": {
"contextChatMatch": false,
"in_sentence": false,
"keywordMatchSize": 1,
"keywords": [
"hello"
],
"near_dialogue": false,
"useEasAlgorithm": false
},
"type": "HIT_ANY_KEYWORDS"
}
],
"rid": "30526"
},
{
"check_range": {},
"cid": "b",
"id": 92496,
"lambda": "93290",
"operators": [
{
"id": 93290,
"oid": "93290",
"param": {
"average": false,
"minWordSize": 4,
"near_dialogue": false,
"useEasAlgorithm": false,
"velocity": 0.005,
"velocityInMint": 300
},
"type": "SPEECH_SPEED_CHECK"
}
],
"rid": "30526"
}
],
"count": 1,
"rules": [
{
"autoReview": 1,
"comments": "This is a sample rule!",
"configType": 1,
"createEmpid": "374915893923532146",
"createTime": 1663654165000,
"expectedScore": 0.7,
"fullCycle": 1,
"isDelete": 0,
"isOnline": 0,
"lambda": "a&&b",
"lastUpdateEmpid": "374915893923532146",
"lastUpdateTime": 1663654165000,
"level": 2,
"meet": 1,
"name": "Rule Demo",
"qualityCheckType": 0,
"rid": "30526",
"ridLong": 30526,
"ruleCategoryName": "Service Specification",
"ruleScoreType": 3,
"ruleType": 1,
"scoreNum": 10,
"scoreNumType": 0,
"scoreRuleHitType": 0,
"scoreType": 3,
"status": 0,
"targetType": 10,
"taskFlowId": -1,
"triggers": [
"a",
"b"
],
"type": 1
}
]
}
}