Skip to content

Knowledge Bases

A Knowledge Base (KB) is a collection of documents that your bot can search during a conversation to provide answers grounded in your own content. Instead of relying solely on the LLM's training data, the bot retrieves relevant passages from your documents and uses them as context when generating a response. This technique is called retrieval-augmented generation (RAG).

How RAG Works

When a user asks a question, the platform performs the following steps:

  1. Embed the query -- The user's message is converted into a vector embedding using the same model that indexed your documents.
  2. Search the vector store -- The embedding is compared against all document chunks in the Knowledge Base using cosine similarity on pgvector.
  3. Retrieve top results -- The most relevant chunks (controlled by top_k and similarity threshold) are returned.
  4. Generate a response -- The retrieved chunks are injected into the LLM prompt as context, and the model generates an answer based on that content.

This means the bot's answers stay accurate and up-to-date as long as your documents are current -- no model retraining required.

imageRAG pipeline diagram showing five stages: Upload documents, Chunk text, Generate embeddings, Store in pgvector, and Retrieve matching chunks for LLM context
The RAG pipeline: from document upload to retrieval

Architecture Overview

StageWhat HappensWhere
UploadDocuments are uploaded or synced from an external sourceKB Service
ChunkingDocuments are split into overlapping text chunksIndexing Service
EmbeddingEach chunk is converted to a vector using an embedding modelIndexing Service
StorageChunks and vectors are stored in AlloyDB with pgvectorAlloyDB
RetrievalIncoming queries are embedded and matched via vector similarityRAG Service

Viewing Your Knowledge Bases

Navigate to Building > Knowledge Bases in the Operations Portal. The list view shows all Knowledge Bases for your tenant with the following details:

ColumnDescription
NameThe display name of the Knowledge Base
DocumentsNumber of documents indexed
ChunksTotal number of text chunks across all documents
Embedding ModelThe model used to generate vectors
Last UpdatedTimestamp of the most recent indexing run
StatusOverall health: Ready, Indexing, or Error

Click any row to open the Knowledge Base detail view, where you can manage documents, configure RAG settings, and connect external sources.

imageKnowledge Bases list view showing table with columns for Name, Documents count, Chunks count, Embedding Model, Last Updated, and Status
The Knowledge Bases list view

Creating a Knowledge Base

To create a new Knowledge Base, click the New Knowledge Base button in the top-right corner of the list view. You will provide a name, description, and embedding model configuration. See Creating a Knowledge Base for the full walkthrough.

Using a Knowledge Base in a Flow

Once your Knowledge Base has indexed documents, you can query it from a flow using the KB Search node. The node lets you select which Knowledge Base to search, configure retrieval parameters, and store the results in a session variable for downstream use.

A typical KB Search node configuration looks like this:

SettingExample ValuePurpose
Knowledge BaseProduct DocumentationThe KB to query
Output Variablekb_resultsSession variable where results are stored
top_k5Number of chunks to retrieve (overrides KB default)
Threshold0.7Minimum similarity score (overrides KB default)

The output variable contains an array of matching chunks, each with a content field and a score field. You can feed these results into an LLM Response node to generate an answer grounded in the retrieved content.

TIP

You can use the sys_page_label system variable in a KB Search node to dynamically select a Knowledge Base by name. This is useful when the same flow serves multiple contexts -- for example, different product pages on your website each mapping to a dedicated KB.

Sections

WARNING

Knowledge Base content is scoped to your tenant. Other tenants on the platform cannot access your documents or embeddings. Always verify that sensitive documents are appropriate for bot-assisted retrieval before uploading.

OmniBots AI Bot Platform