Skip to main content
工作流应用

Knowledge Base Node

The Knowledge Base node enables Retrieval-Augmented Generation (RAG) by retrieving relevant information snippets from a specified knowledge base and passing the retrieved results as context to downstream Large Language Model (LLM) nodes. This helps address common LLM limitations such as outdated knowledge, inability to access private data, and tendency to hallucinate.

Adding the Node

Method 1: Add via Plus Button

  • Click the plus (+) button at the end of any node on the canvas.
  • Select the Knowledge Base node from the pop-up list.
  • The node is automatically added to the canvas and connected to the upstream node.

Method 2: Drag & Drop from Node Library

  • Locate the Knowledge Base node in the left-side node management panel.
  • Drag it onto the desired position on the canvas.
  • Manually connect it to upstream and downstream nodes.

Core Configuration

Input Configuration

Defines the basis for retrieval from the knowledge base.
ParameterDescription
contentText to be searched. You can enter plain text directly, or type / or trigger variable selection in the editor to reference output variables from upstream nodes.
imageListImages to be searched. Accepts publicly accessible image URLs (e.g., https://xxx.xxx.com/xxx/xxx.jpeg) or variable references via / or variable selection in the editor.

Knowledge Base Selection Method

The Knowledge Base node supports two ways to select knowledge bases:
Selection MethodUse CaseConfiguration Notes
Select Fixed Knowledge BaseKnowledge base is static—same one used on every invocation.Choose a specific knowledge base from the dropdown menu. Supports documents, tables, and images.
Dynamic ImportKnowledge base(s) used are determined dynamically based on upstream node outputs.Configure a CodeList variable—specify the knowledge base list either by referencing a variable or entering it directly.

Knowledge Base Invocation Mode

Defines the logic for triggering the knowledge base. Default: Always Invoke.
ModeDescriptionRequired Parameters
Always InvokeEvery user input triggers knowledge base retrieval—ideal for high-frequency Q&A scenarios.None required.
Smart InvokeThe agent decides whether to retrieve, based on user input and the provided Knowledge Base Description—ideal for flexible conversational flows.Knowledge Base Description (required)
Legacy InvokeRetrieves mixed results across document/table/image knowledge bases, using topK to globally cap total retrieved items. Does not support per-type debugging.topK (range: 1–50; default: 10)
Parameter Notes:- Knowledge Base Description: Describes the content covered in the knowledge base and specifies under what conditions its data should be used for responses. Accepts plain text or variable insertion.- topK: Maximum number of text chunks retrieved per knowledge base. Actual count may be lower depending on match quality.

Knowledge Base Type

Specifies which types of knowledge base your application needs to search. Three types supported:
TypeDescription
DocumentBuilt from document-style data. The model can cite text snippets to answer questions.
TableBuilt from tabular or database-style data. The model can cite query results to answer questions.
ImageBuilt from image data. The model can retrieve images and reference associated image descriptions to answer questions.

Debugging Retrieval Results

Supported only in Always Invoke and Smart Invoke modes. Click the debug button next to Document, Table, or Image to test retrieval performance for that type—and iteratively refine your knowledge base configuration strategy based on returned results. Once verified, click Save (top-right corner) to apply changes to the current application.

Knowledge Base Filtering

Disabled by default. When enabled, the system leverages an LLM to perform secondary intelligent filtering on retrieved document and table results—improving final output quality. Recommended for applications requiring high answer precision or needing to filter out irrelevant content.

Node Output

The Knowledge Base node outputs a structured object containing a result field:
FieldTypeDescription
resultObjectOverall output containing all retrieval results.
result.chunkListArray<Object>List of retrieved knowledge base chunks. Empty if none found.
result.chunkList[ ].contentStringRaw content of the retrieved chunk.
result.chunkList[ ].titleStringTitle of the document the chunk belongs to.
result.chunkList[ ].documentNameStringName of the knowledge base containing the chunk.
result.chunkList[ ].scoreNumberSimilarity score of the chunk—higher values indicate stronger relevance.
result.chunkList[ ].idStringChunk ID.
result.chunkList[ ].dataIdStringDocument ID.
result.chunkList[ ].docUrlStringSource file download URL.
result.chunkList[ ].knowledgeBaseIdStringKnowledge base ID.
result.chunkList[ ].nidStringOriginal source identifier.
result.chunkList[ ].imagesArray<String>List of associated image URLs.
result.chunkList[ ].pageNumberArray<Number>Page numbers where the chunk appears.
result.rewriteQueryStringRewritten version of the user's original query.

Common Usage Patterns

Paired NodeTypical Use Case
Knowledge Base → LLM NodePass retrieved knowledge as context to the LLM for knowledge-grounded response generation.
Intent Classification → Knowledge Base NodeFirst classify user intent, then decide whether to invoke the knowledge base—or which knowledge base to use.
Knowledge Base → Conditional NodeRoute subsequent logic based on whether retrieval returned results—or on chunk score thresholds.
Knowledge Base → Variable Processing → LLM NodeTransform or extract key content from retrieval results before feeding them to the LLM.

Frequently Asked Questions

Why is the retrieval result empty?

Empty results may stem from:
  • Query content being unrelated to knowledge base content
  • Incorrect knowledge base configuration or incomplete indexing
  • Failure to meet invocation conditions in Smart Invoke mode
Solution: Use the debug feature to test retrieval behavior and verify both query input and knowledge base configuration.

How can I improve retrieval accuracy?

  • Optimize document chunking strategies in your knowledge base.
  • Enable Knowledge Base Filtering, and customize the filtering prompt for secondary refinement.
  • In Smart Invoke mode, refine your Knowledge Base Description and invocation conditions.