Technical guide · Published 2026-12-01 · 7 min read
How to Build an AI Knowledge Base Chatbot That Cites Sources
The difference between a chatbot people trust and one they ignore is not fluency. It is whether every answer can be traced back to a document you approved.

Why citations change everything
Without citations, a wrong answer is indistinguishable from a right one, so users learn to distrust all of them. With citations, a wrong answer is a bug report with an address: the document was outdated, the chunk was split badly, or the retrieval missed the right section.
That is also what makes the system maintainable. You fix the knowledge, not the prompt, and the fix applies to every future answer.
The pipeline, step by step
Six stages, each with its own failure mode.
- Ingest: PDFs, Word, pages, spreadsheets and past conversations, with the source of each document recorded
- Clean: strip headers, footers, navigation and boilerplate, so the index is not full of page numbers
- Chunk: split by meaning, not by character count, and keep the heading hierarchy attached to each chunk
- Index: embed and store with metadata (document, section, date, owner, permission)
- Retrieve and generate: pull the top candidates, answer only from them, return the source with the reply
- Evaluate: a fixed set of real questions with known correct answers, re-run after every change
Permissions are part of the design
An internal assistant that answers HR questions to the sales team is a data leak with good manners. Permissions must be attached to the chunk at ingest time, checked at retrieval time, and reflected in the interface (a user should be able to see why they cannot see something).
If data cannot leave your environment, the whole stack — embeddings, vector store, model — must run on your own infrastructure. That is a deployment decision, not a feature toggle, and it should be priced as one.
Measure before you scale
Build a hundred-question evaluation set from real conversations before launch. Track three numbers: answer accuracy, citation correctness, and handover rate. A bot with 78 percent accuracy that always hands over with context is more useful than one at 88 percent that never escalates.
Then improve in that order: knowledge gaps first, retrieval second, generation last. Most quality problems live in the documents, not in the model.
Questions
Questions
How many documents do we need to start?
A hundred pages of authoritative content is enough to prove the system works. Start with the documents your support team actually quotes, not with everything the company has ever written.
Can it read scanned PDFs?
Yes, with OCR, but quality matters: a paragraph OCR'd with three broken characters will be retrieved and quoted with those broken characters. Prefer born-digital sources and clean scans.
Does it work in Chinese and English at once?
Yes. The index can be multilingual and answers can follow the user's language, but per-language evaluation sets are needed because retrieval quality differs by language.
Send us the documents you trust most
We will tell you what the index can answer with them, what it cannot, and what it costs to close the gap.