What problem RAG solves
A general language model does not know your return policy, your product specifications or last month's price list. Pasting everything into every prompt is wasteful and often impossible. RAG fixes this by searching your knowledge first, then asking the model to answer using only what was found. The model supplies the language; your documents supply the facts.
Step 1: Define the audience and questions
Decide who will ask: customers on your website, staff on an intranet, support agents inside a helpdesk. Collect fifty real questions from emails, tickets and calls. This list shapes which documents you need and later becomes your test set.
Step 2: Collect and clean the sources
Gather the documents that contain answers: help centre pages, PDFs, policies, product sheets, wiki pages, past ticket resolutions. Then edit.
- Remove duplicates and old versions.
- Resolve contradictions, such as two different delivery times.
- Add dates and owners.
- Rewrite vague sections into clear statements.
- Put one topic in one document where possible.
Scanned PDFs need text extraction, and tables often need rework since they flatten badly into text.
Step 3: Split documents into chunks
Documents are divided into passages, usually a few hundred words each, so search can return the specific part that answers the question. Split along natural boundaries like headings, not at fixed character counts that cut a sentence in half. Keep the document title and section heading attached to each chunk, as they help retrieval and citations. Overlap lightly if answers span sections.
Step 4: Index for search
Each chunk is converted to an embedding, a list of numbers that represents meaning, and stored in a vector database or a database with vector support. Many teams also add keyword search and combine the two, called hybrid search, since exact terms such as part numbers and names are matched better by keywords. Store metadata with each chunk: source URL, product, region, language, date and access level.
Step 5: Retrieve and re-rank
When a question arrives, the system searches the index and returns the best chunks. A re-ranking step can reorder them by relevance. Filter by metadata first where you can, for instance restricting to the customer's country. Retrieve a modest number of chunks; too many dilute the answer.
Step 6: Write the answer prompt
Instruct the model to answer only from the supplied passages, to cite the source, to say "I don't have that information" when the passages don't contain the answer, and to ask a clarifying question when the query is ambiguous. Define tone and length. Do not let it guess prices or legal statements. Keep these instructions short and test them.
Step 7: Show sources
Display the source documents or links under each answer. This lets users verify, makes errors discoverable, and builds trust. For staff-facing tools, link straight to the paragraph.
Step 8: Add handover and limits
Offer a path to a human when the bot lacks an answer. Decide topics that must never be answered automatically, such as legal advice, medical advice or account-specific data unless the user is authenticated. Log unanswered questions; they point to missing documentation.
Step 9: Test with a question set
Use your fifty questions plus tricky variants: misspellings, vague wording, questions with no answer in the documents, questions about outdated policies, and attempts to trick the bot into ignoring instructions. For each, record whether retrieval found the right passage and whether the answer was correct and grounded. Fix retrieval problems first (chunking, metadata, hybrid search), then prompt problems. See our guide on evaluating chatbots for scoring.
Step 10: Keep content fresh
Set up automatic re-indexing when documents change, and a process for removing retired documents. Assign a content owner. A chatbot is only as current as its sources. Review the logs monthly: new questions, thumbs-down answers and escalations.
Security and privacy
- Keep private documents behind authentication and enforce permissions at retrieval.
- Understand how your model provider handles data and whether prompts are retained.
- Avoid putting secrets, such as passwords, into indexed content.
- Log access for audit.
Common failure modes
- Poorly extracted PDFs that turn tables into jumbled text.
- Chunks that lose context, like "it costs the same" without the product name.
- Old and new policy versions both indexed.
- A confident answer when retrieval found nothing relevant.
- No owner for content updates.
How we help
We audit your documents, build the pipeline for ingestion, search and answer generation, connect it to your website or helpdesk, and set up testing and monitoring so quality is visible.
Questions, answered
Retrieval-augmented generation. The system retrieves relevant text from your content and gives it to the model as context for its answer.
No. RAG leaves the model unchanged and feeds it your content at question time, which is easier to update and audit than training.
Current, well-written, single-topic documents such as policies, product manuals, FAQs and procedures. Contradictory or outdated files produce contradictory answers.
Yes, if permissions are stored with the content and checked at retrieval time. Plan this early for internal chatbots.