RAG Knowledge Base & Semantic Grounding
The intelligence center powering NotifyIQ's AI auto-replies. Ingest company policies, FAQs, and product sheets into 768-dimensional Google Gemini vector embeddings, index them in MongoDB Vector Search, and guarantee strictly grounded WhatsApp customer responses.
1. Purpose of the Page
Retrieval-Augmented Generation (RAG) ensures that AI auto-replies in WhatsApp are 100% accurate, factual, and strictly bounded by your company's verified documentation. The Knowledge Base interface provides tools to upload text and documents (PDF, DOCX, CSV, TXT), automatically split them into 500-token chunks, compute semantic embeddings, and test retrieval in an interactive playground before deploying to production customer chats.
2. Who Uses It (Target Roles)
Uploads operating procedures, troubleshooting checklists, and returns/warranty policies.
Maintains pricing schedules, feature matrices, and product catalogs for instant bot quoting.
Evaluates cosine similarity confidence scores and inspects source citations in the Playground.
Interactive Visual Preview
gemini-embedding-001 • 8 Indexed DocsClients can receive a full refund if the cancellation request is submitted within 14 calendar days of plan activation. Refunds are processed back to the original payment method within 5-7 business days.
3. Step-by-Step: Adding and Testing Knowledge
- Upload Knowledge Documents: Go to the Upload Documents tab. Either drag in a file (
.pdf,.docx,.txt,.csv) or paste raw text with a descriptive document title. - Automatic Token Chunking: NotifyIQ automatically breaks documents into 500-token chunks with 50-token semantic overlap. This prevents context fragmentation across sentences.
- Vector Embedding Generation: The backend sends text chunks to Google Gemini API (
models/embedding-001), creating 768-dimension dense vector arrays saved to MongoDB with vector index markers. - Run Playground Verification Queries: Switch to the RAG Query Playground tab. Enter typical customer questions (e.g. “How do I configure my webhook?”) and verify that the AI cites the correct source document and displays high confidence (>85%).
- Manage & Prune Documents: View all active indexed documents in the repository table. When company policies update, delete outdated versions to prevent contradictory answers.
4. Controls, Endpoints & Vector Specifications
| Feature / Parameter | API Route | Specification | Description |
|---|---|---|---|
| Index Document | POST /api/ai/knowledge | title, content, fileType | Splits raw text into 500-token chunks and computes Gemini 768-dim embeddings. |
| Delete Document | DELETE /api/ai/knowledge/:id | docId | Purges all chunk embeddings associated with the specified document from MongoDB. |
| RAG Playground Query | POST /api/ai/query | query: string | Executes vector cosine search and generates grounded synthesized text with citations. |
| Embedding Model | Google Gemini API | gemini-embedding-001 (768d) | Generates dense semantic vector representations for similarity ranking. |
5. Behind the Scenes: Real-Time RAG Auto-Reply Pipeline
When a customer sends a WhatsApp message while the AI bot is enabled, the backend executes the following RAG sequence:
- Query Vectorization: The inbound message text is vectorized in real time using
gemini-embedding-001. - MongoDB Atlas Vector Search: An approximate nearest neighbor (ANN) search retrieves the top 3 most relevant document chunks based on cosine distance.
- Grounded Generation: Retrieved chunks are injected into the Gemini system prompt: “You are a WhatsApp customer care agent for NotifyIQ. Only answer questions using the provided context chunks. If the answer is not in the context, politely state that you will connect them with a human agent.”
- WhatsApp Delivery: The synthesized message is dispatched via Meta Graph API v20.0 with delivery receipts logged.
6. Common Errors & FAQs
NotifyIQ strictly prevents AI hallucination. If the customer's question cannot be matched with high cosine confidence against your indexed documents, the bot will decline to speculate and offer human agent handoff.
There is no arbitrary document count limit. Storage and token usage are calculated based on your workspace billing tier and wholesale token consumption.