The knowledge base retrieval scope settings is used to configure the mapping relationship between API parameters and label names, to implement scenarios where users with different identities retrieve knowledge from different scopes when asking questions.
2. Tag: refers to the tag name maintained in tag management, used for tagging documents and QA.
Function Description
How to Choose "And" or "Or"
Case background:
1. Pass in {"UserID":"Internal","Department":"R&D"} in custom_variables.
2. Configure mapping relationship in knowledge search scope settings.
Fill in the API parameter with the label name "UserID" mapped to "User".
Fill in the API parameter with the label name "Department" mapped to "Department".
The label values of user identity include internal employee and external user. The label values of department include Product Department, R & D Department, and Test Department.
Set the API parameter to "and"
When importing multiple parameters that map to multiple labels, it will retrieve knowledge that contains both multiple labels as well as untagged knowledge.
Take the above case as an example. The final result: Retrieve knowledge with "User" being "Internal" and "Department" being "R&D", as well as untagged knowledge.
Set the API parameter to "or"
When importing multiple parameters that map to multiple labels, it will retrieve knowledge containing any label as well as untagged knowledge.
Take the above case as an example. The final result: Retrieve knowledge with "User" being "Internal", or knowledge with "Department" being "R&D", or untagged knowledge.
Configure the Mapping Relationship between API Parameters and Tag Names
API parameter name
Note:
API parameter name must be consistent with the parameter passed in custom_variables, and the format requirement begins with an English letter, supporting English and underscore "_".
Label name
Maintain label names and label values in label management. Support tagging for documents/Q&As. Support selecting labels in label management in Knowledge Base Retrieval Scope Settings, configuring the mapping relationship between API parameters and label names. After a user asks a question with parameters passed through custom_variables, retrieve knowledge of the corresponding label and answer.
Note:
1. The parameters passed through custom_variables to retrieve the knowledge of the corresponding label must configure the mapping relationship between API parameters and label names in the knowledge base retrieval scope settings.
2. Before configuring the mapping relationship, it is advisable to first maintain labels and tag documents/QAs in label management.
Usage Scenario and Operation Steps
Usage Scenario Overview
When the currently connected business expects users with different identities to ask questions with limited access to a certain range of knowledge for responses, for example, department A personnel can only consult knowledge under department A, and asking about other departments requires providing a rejection scenario.
Take the following scenario as an example:
Scenario case:
User identity (case-sensitive for external users and internal employees). Internal employees must distinguish between different departments (Product Department, R&D Department, Test Department), while external users are not categorized by other identities. Implement knowledge isolation between different identities and departments. When a user asks a question, the system can only retrieve knowledge corresponding to their identity/department to respond.
User identity: UserID
Department: Department
Operation Step Description
Step 1: Create a Label in Label Management
Enter the label management feature from the document/QA label. Create two label names: "User" and "Department". The standard words for user identity include external user and internal employee; the departments include R&D Departmentand Sales Department.
Step 2: Tag a Document/QA
1. Documents visible to external users. Select "Label Name = User" and "Label Value = External" in the file label; no need to set the department label.
2. Documents visible to internal employees
"Label Name = User", "Tag Value = Internal".
"Label Name = Department", "Tag Value = R&D". Select the label value based on the actual visible scope of employees.
Step 3: Set Knowledge Base Retrieval Scope
In Knowledge Management > Knowledge Library Settings > Knowledge Base Retrieval Scope Settings, set the API parameter to "AND", with API parameter name "UserID", mapped tag name "User Identity"; API parameter name "Department", mapped tag name "Department".
Step 4: Apply the Dialogue API Input Parameter
In the custom_variables field of the application dialogue end, input parameters and parameter values.
External
"custom_variables":{
"UserID": "External"
}
Internal
"custom_variables":{
"UserID": "Internal"
"Department": "R&D"
}
Complete the above steps to configure and pass parameters. In the dialogue, users with different identities can ask questions and retrieve knowledge within a certain range for responses.