Rule object description
This topic describes the structure of rule objects.
First, perform operations on the frontend and use the developer tools in your browser to obtain the request parameters. Use these parameters as a template to build your desired object structure.
Rule types
There are two types of rules: standard quality inspection rules and flow quality inspection rules. For simplicity, this topic uses "rules" to refer to standard quality inspection rules and "flows" to refer to flow quality inspection rules. They are described separately below.
Standard quality inspection rules
The standard quality inspection rule system consists of three levels: rules, conditions, and operators. For more information about their meanings, see Glossary.
A rule contains multiple conditions. Each condition corresponds to an operator.
RulesInfo
This object contains the information for a ruleset. APIs such as getRuleById use this structure.
Rule
Description
Description of the data property:
Property | Value type | Example value | Description |
conditions | Array | [] | Configuration information for all conditions. For more information, see the description of the conditions property below. |
rules | Array | [] | Configuration information for all rules. For more information, see the description of the rules property below. |
Description of the conditions property:
Property | Value type | Example value | Description |
cid | String | "a" | The conditional ID in letter format. It is used for display on the page. |
id | Long | 1233 | The conditional ID. |
rid | String | "232" | The rule ID. |
check_range | Struct | For more information, see the following. Condition check range (CheckRange) | The check scope of the condition. |
operators | List | For details, see the OperatorBasicInfo for the operator in the condition | The operators included in the condition. |
lambda | String | "1222" | The logical relationship between operators in the condition. |
Condition check range (CheckRange):
Property | Value type | Example value | Description |
role | String | Service Agent | The applicable role. Possible values: "Service Agent", "Customer", or "All ". |
anchor | Anchor | For more information, see the following. Description of Anchor below. | The details of the prerequisite. |
range | String | {"from": 1, "to": 3} | The detection range. |
Prerequisites:
Property | Value type | Example value | Description |
cid | String | "a" | The conditional ID (cid) of the prerequisite. It is used to determine the anchor's condition. |
location | String | AROUND | Specifies the sentences to check when a prerequisite is hit. You can check sentences before, after, or around the hit sentence, or the hit sentence itself. Possible values: BEFORE (before the hit sentence), AROUND (around the hit sentence), AFTER (after the hit sentence), and CURRENT (the hit sentence itself). This field defines a scope. Use it with the from and to parameters in the range field to specify the exact sentences. |
hit_time | Integer | 3 | The number of times the prerequisite is hit. The return value can be one of the following: 1. A positive integer from 1 to N, which indicates the first to Nth hit. 2. 0, which indicates every hit. 3. -1, which indicates any hit. |
Description of OperatorBasicInfo
Property | Value type | Example value | Description |
oid | String | "1222" | The operator ID. |
name | String | I am an operator name | The operator name or description. |
type | String | INCLUDE_KEYWORDS | The operator type. For more information, see Add a rule. |
param | Param | The content of the operator expression. For more information, see Add a rule. |
Description of the rules property:
Property | Value type | Example value | Description |
rid | String | 1 | The rule ID. |
lambda | String | a&&b&&c | The logical relationship between conditions in the rule. |
business | List | The following provides more details. Description of the BusinessCategoryBasicInfo field for the rule | The applicable services for the rule. |
type | Integer | 1 | The rule type. |
triggers | List | ["a","b","c"] | The conditional IDs (cids) in the rule for which content needs to be returned. |
name | String | "Customer may complain" | The rule name. |
scoreSubId | Integer | 3678 | The ID of the scoring sub-item attached to the rule. |
ruleScoreType | Integer | 3 | Specifies whether the scoring item attached to this rule is scored. 1: not scored. 3: scored. |
level | Integer | 2 | The severity level: 0 (severe violation), 1 (moderate violation), 2 (minor violation) |
fullCycle | Integer | 1 | The type of effective period for the rule: 0 (The rule is effective only during a specific period), 1 (The rule is always effective) |
effectiveStartTime | Date | 1640620800000 | The start time of the effective period when the rule is effective only for a specific period. |
effectiveEndTime | Date | 1640620800000 | The end time of the effective period when the rule is effective only for a specific period. |
autoReview | Integer | 1 | Specifies whether to enable automatic review. Possible values: 1 (No) or 3 (Yes). |
comments | String | Checks for prohibited words. | The remarks for the rule. |
qualityCheckType | Integer | 0 | Specifies whether this is a real-time quality inspection rule. Possible values: 0 (No) or 1 (Yes). |
Description of the businessCategoryBasicInfoList property:
Property | Value type | Example value | Description |
bid | Long | 574599480 | The applicable service ID. |
name | String | Pre-sales service | You can use the service name. |
Example rule
{
"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 rule demo!",
"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
}
]
}
}