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. Label name: Refers to the label name maintained in label management, used for tagging files and QAs.
Feature Overview
Knowledge Base Retrieval Scope Settings
Configure the mapping relationship between API parameters and label names. After configuration, the parameter content passed through the custom_variables field of the application dialogue endpoint API will match the knowledge of the corresponding label value. For details, see Overall Overview of Dialogue API. How to Choose "And" or "Or"
Case background:
1. Pass in {"UserID":"Internal","Department":"R&D"} in custom_variables.
2. Configure mapping relationship in the 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.
Configuring the Mapping Relationship between API Parameters and Tag Names
API parameter name
Note:
API parameter name must match the parameter passed in custom_variables, begin with an English letter, and support English letters and underscores "_".
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 a user with a specific identity asks to retrieve knowledge within a limited scope, for example, an employee from department A can only consult knowledge under department A, and queries about other departments must be rejected.
In the following scenario:
Scenario Case:
User identity (case-sensitive for external users and internal employees). Internal employees must be distinguished by department (Product Department, R&D Department, Test Department), while external users have no other identity distinctions. To achieve 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
Note: 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 Base 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 Four: Apply Dialogue API Input Parameter
Apply Dialogue API custom_variables field with input parameters and parameter values.
External User
"custom_variables":{
"UserID": "External"
}
Internal User
"custom_variables":{
"UserID": "Internal"
"Department": "R&D"
}
Complete the above steps to configure and pass parameters. The dialogue can then limit different identity users to retrieve certain knowledge and provide responses.