Knowledge base
Overview
The knowledge base feature allows you to centrally manage and structure unstructured data such as documents, product data, Frequently Asked Questions (FAQ), and business specifications within the enterprise, making it an external knowledge source that can be retrieved by large language models (LLM) at any time.
Unlike the static data used by large models in pre-training, the contents of this knowledge base can be updated at any time. This ensures that your AI agents have access to the most up-to-date and accurate information, thus avoiding answer errors caused by outdated or missing knowledge.
Working principle
When the AI intelligence is configured with a knowledge base, its response process is as follows:
-
User questions trigger retrieval: When a user's question is received, the system does not directly ask the big model to answer it. Instead, the system uses the user's question as a retrieval instruction and performs a semantic search in the knowledge base you configured.
-
Recall and filter relevant knowledge: The knowledge base recalls the most relevant pieces of content from a large number of documents based on semantic similarity. This process can be refined by the following core parameters:
Top K (number of candidates): defines how many of the most relevant pieces of knowledge the system grabs at once from the knowledge base. The higher the k value, the more comprehensive the information coverage may be, but it also brings higher delay and cost.
Score Threshold (Relevance): This is a quality threshold, and only pieces of knowledge with a similarity Score above this threshold will be adopted. The higher the threshold, the more relevant the recalled content is to the problem, but it may also lead to "no content for reference" due to strict conditions ".
-
Dynamic injection context: The filtered piece of high-quality knowledge will be used as a named.
{{currentKnowledgeBase}}The variables are dynamically, in real time, injected into the instructions (Prompt) sent to the large language model. -
Generate accurate answers: After receiving instructions, large language models will be strictly required to "must be based on
{{currentKnowledgeBase}}To generate an answer with the information provided in ". This greatly constrains the answer range of the model from "open authoring" to "understanding and answering based on a given material", resulting in more accurate and reliable answers.
In this way, developers can ensure that AI agents not only rely on their inherent general knowledge, but also process dynamic information from real-time enterprise documents, significantly improving the accuracy and relevance of answers.
Core advantages
Real-time (Real-time): The data in the knowledge base can be updated at any time to ensure that the AI intelligence obtains the latest context information and responds to business changes immediately.
Accurate (Precision): Through retrieval enhancement generation (RAG) technology, forcing the model to answer based on a given, credible document fragment can effectively reduce the phenomenon of "model illusion" (I. E., fabricating information out of thin air).
Flexibility: Developers can easily connect to their own external knowledge base (such as Dify), and adjust the recall parameters (Top K, Score threshold) according to specific business scenarios to balance the relevance and response speed of responses to ensure the best customer experience.
Dify Preconfigured Knowledge Base
Overview - Dify Docs
NXLINK Connecting to an External Knowledge Base
Take Dify as an example
Authentication Information Preparation
Add request header authentication required for Dify
Request header Authorization
|
Request Header |
Value |
|
|
Authorization |
Bearer {{dify api key}} |
{{dify api key}} Dify Cloud Obtain |

Fill in knowledge base connection information

Top K (number of candidates)
Retrieve the top K most similar questions/paragraphs by similarity from the vector library and use them as context for the large model.
Larger K: more complete recall (not easy to leak), but higher cost and delay, and may bring in less relevant paragraphs.
Score threshold (lower similarity limit)
Add a threshold to the retrieved paragraph: If the similarity is lower than the threshold, discard it directly.
The higher the threshold: more accurate (less digression), but **more likely to" not get the content "** causing the model to say it doesn't know.
Simple mental model: Top K = breadth/catch; Score threshold = quality threshold/how much to count.
How the two work together (example)
Candidate similarity: 0.78, 0.33, 0.29, 0.08
Top K = 3, Threshold = 0.10 ⇒ Return 0.78, 0.33, 0.29
Top K = 3, Threshold = 0.40 ⇒ Return only 0.78
Top K = 2, Threshold = 0.10 ⇒ Return 0.78, 0.33
The time of knowledge base recall affects the time for the intelligent body to reply to the customer, in the delay-sensitive scenario, Please strictly control the use of knowledge base and parameters, balance the response correlation and response speed, to ensure the customer experience.
After the connection is completed, click Experience Recall

The agent uses the knowledge base.
Once a connected knowledge base is selected, the knowledge base can be used by referencing the variable {{currentKnowledgeBase}} within the prompt.
The time of knowledge base recall affects the time for the intelligent body to reply to the customer, in the delay-sensitive scenario, Please strictly control the use of knowledge base and parameters, balance the response correlation and response speed, to ensure the customer experience.


Comparison of response content with or without knowledge base

