Knowledge Base Nodes

A knowledge base node performs a search or retrieval operation on a knowledge base of your choice, returning relevant document chunks or information in response to a query. The files uploaded to the Knowledge Base node can be reused across multiple flows. All created knowledge bases are automatically synced to the Knowledge Base Dashboard.


Node Settings & Search Parameters

Click on the node to change its settings.

At the top of the window, you will find a drop-down menu to select a Knowledge Base or choose documents to form a new Knowledge Base. You can select or de-select individual documents that you'd like to include.

Settings + Search Parameters

Below that you will see the configurations for Settings and Search Parameters

  • Output Format: Choose between chunks, pages, and docs.

  • Metadata Filter Strategy: Choose between Strict Filter, Loose Filter, and No Filter.

  • Query Strategy: Choose between Semantic, Keyword, and Hybrid.

  • Top Results: Number of search results ranked by relevance.

  • Max Characters: Limits the number of characters sent to the LLM.

  • Answer Multiple Questions: Get the answers from multiple questions in parallel.

  • Advanced Q&A: Handle questions to compare or summarize documents. By enabling this feature, the knowledge base search will automatically use "retrieval utilities" to select the best mechanism to answer the user questions depending on whether the question aims to: retrieve a fact, compare a set of documents, or summarize a document inside the knowledge base.

  • Rerank: Get more precise information retrieval. The knowledge base will divide its number of results in half with the most relevant results, using a sophisticated ranking algorithm. This will reduce token usage.

  • Query Transformation: Get more precise information retrieval. Forces the knowledge base to rewrite the user message as a better question. This increases the quality of the search results for the language model.

Advanced Upload Parameters

Some nodes, like the Websites Node and Google Drive Node, will also allow you to specify Advanced Upload Parameters, settings for how you'd like your documents to be ingested. You can also control these parameters from the KB Dashboard.

  • Model for Embeddings: as default, the text-embedding-3-large model from OpenAI is selected. However, you will have the option to select the following ones: azure-text-embedding-ada-002, bert-base-cased, all-mpnset-base, palm2 and more.

  • Chunking algorithm: by default, the system uses sentence. You can also choose naive.

  • Chunk overlap: by default, the system uses 500. You can also choose as many as you want up to 4500 by clicking the number and editing it.

  • Chunk length: by default, the system uses 2500. You can also choose as many as you want up to 4500 by clicking the number and editing it.

  • Advanced Data Extraction: For complex data like tables, images, charts. Enable it if you want to extract text from images that are present in your documents. By default, this option is deselected since it will increase the latency of your workflow (i.e., it will run slower).

  • Text in imgs (OCR): by default, this option is deselected. Enable it if you want to extract text from imgs that are present in your documents.

  • Embeddings API key: by default, the text field is empty. Stack AI's API key are used. If you would like to use yours, then include your API key in this text field.

Chunking Algorithms

StackAI implements both sentence and naive chunking algorithms:

Naive Algorithms are typically simpler and less sophisticated. They often rely on basic methods like searching for specific keywords or phrases.

  • Lack of Context Understanding: they usually don't understand the context or the structure of the language. For example, a naive algorithm might count the frequency of words without understanding their meaning or part of speech.

  • Speed and Efficiency: due to their simplicity, these algorithms can be faster and more efficient, especially for straightforward tasks.

  • Limitations: naive algorithms are generally less accurate in complex language processing tasks. They might miss nuances, sarcasm, or idiomatic expressions.

Sentence Chunking Algorithms are more sophisticated. They involve breaking down text into syntactically correlated parts of words like noun phrases, verb phrases, etc.

  • Context and Structure Understanding: sentence chunking algorithms understand the structure of a sentence. They analyze parts of speech and how words relate to each other in a sentence.

  • Accuracy: they are more accurate in understanding the meaning and context of sentences. This makes them suitable for complex tasks like sentiment analysis, information extraction, and language translation.

  • Resource Intensity: these algorithms are usually more resource-intensive due to their complexity. They might require more computational power and time to process text.

File Status

You will see a label for each document that you upload with the following icons:

  • Pending: the document is being processed and indexed.

  • ✅: the document was successfully indexed.

  • Error: the document could not be indexed (e.g., due to a formatting issue).

Typical Workflow Structure

A common pattern is:

  1. User Input (Input Node): The user provides a question or prompt.

  2. Knowledge Base Node: Receives the user’s query (directly or via an LLM node) and retrieves relevant information from the knowledge base.

  3. LLM Node: Uses both the user’s input and the retrieved knowledge base content to generate a final, context-rich answer.


How the Interface Works

A. Data Flow

  • The Knowledge Base node typically takes the user’s input as its query, searches the knowledge base, and outputs relevant text chunks.

  • The LLM node can reference the output of the Knowledge Base node in its prompt using the node’s ID.

B. Connections (Edges)

  • The Input node is connected to the Knowledge Base node (for the query).

  • The Knowledge Base node is connected to the LLM node (providing retrieved content).

  • The LLM node is connected to the Output node (displaying the answer).

C. Execution Order

  1. The user submits a question.

  2. The Knowledge Base node receives the question and retrieves relevant information.

  3. The LLM node receives both the user’s question and the retrieved information, then generates a response.

  4. The Output node displays the LLM’s answer.


Why Use This Pattern?

  • Retrieval-Augmented Generation (RAG): This approach allows the LLM to ground its answers in specific, up-to-date, or proprietary knowledge, improving accuracy and relevance.

  • Separation of Concerns: The Knowledge Base node handles retrieval, while the LLM node handles synthesis and reasoning.


Key Points

  • The LLM node does not “search” the knowledge base directly; it relies on the Knowledge Base node to do the retrieval.

  • The LLM node’s prompt must reference the Knowledge Base node’s output to use the retrieved information.

  • All node references must match actual node IDs in the workflow.


Available Knowledge Bases

  • Documents

  • Websites

  • Tables

  • Data

  • Sharepoint

  • Google Drive

  • OneDrive

  • Dropbox

  • Azure Blob Storage

  • AWS S3

  • Notion

  • Confluence

  • Veeva

  • ServiceNow

  • Jira

Last updated

Was this helpful?