Theme
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:
- Embed the query -- The user's message is converted into a vector embedding using the same model that indexed your documents.
- Search the vector store -- The embedding is compared against all document chunks in the Knowledge Base using cosine similarity on pgvector.
- Retrieve top results -- The most relevant chunks (controlled by
top_kand similarity threshold) are returned. - 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.
RAG pipeline diagram showing five stages: Upload documents, Chunk text, Generate embeddings, Store in pgvector, and Retrieve matching chunks for LLM context
Architecture Overview
| Stage | What Happens | Where |
|---|---|---|
| Upload | Documents are uploaded or synced from an external source | KB Service |
| Chunking | Documents are split into overlapping text chunks | Indexing Service |
| Embedding | Each chunk is converted to a vector using an embedding model | Indexing Service |
| Storage | Chunks and vectors are stored in AlloyDB with pgvector | AlloyDB |
| Retrieval | Incoming queries are embedded and matched via vector similarity | RAG 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:
| Column | Description |
|---|---|
| Name | The display name of the Knowledge Base |
| Documents | Number of documents indexed |
| Chunks | Total number of text chunks across all documents |
| Embedding Model | The model used to generate vectors |
| Last Updated | Timestamp of the most recent indexing run |
| Status | Overall 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.
Knowledge Bases list view showing table with columns for Name, Documents count, Chunks count, Embedding Model, Last Updated, and Status
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:
| Setting | Example Value | Purpose |
|---|---|---|
| Knowledge Base | Product Documentation | The KB to query |
| Output Variable | kb_results | Session variable where results are stored |
| top_k | 5 | Number of chunks to retrieve (overrides KB default) |
| Threshold | 0.7 | Minimum 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
- Creating a Knowledge Base -- Step-by-step setup
- Managing Documents -- Upload, monitor, and re-index files
- External Document Sources -- Connect SharePoint, Google Drive, S3, and more
- RAG Settings -- Tune retrieval parameters for answer quality
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.