← Ajit Pandey · Blog

RAG Chatbot: What It Is and How to Build One Safely

A RAG chatbot is a chatbot that looks up passages from your own documents first, then asks a language model to write its answer from those passages. "RAG" stands for retrieval-augmented generation. The goal is an answer based on your current runbooks, policies or product notes instead of on whatever the model remembers from training. This guide explains how the pieces fit, gives a build checklist, and lists the points where these systems usually fail.

What does RAG mean?

Retrieval-augmented generation (RAG) is a method in which a system retrieves relevant information from a knowledge base and adds it to the user's question before the model answers. Anthropic describes it in its Contextual Retrieval write-up as a method that "retrieves relevant information from a knowledge base and appends it to the user's prompt."

The term comes from a 2020 research paper, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks by Patrick Lewis and colleagues. The authors describe RAG as models "which combine pre-trained parametric and non-parametric memory for language generation." In plain terms: the model's built-in knowledge (parametric memory) is combined with an outside store of documents it can search (non-parametric memory).

A few terms used below:

How does a RAG chatbot work?

Anthropic's description of "traditional RAG" gives the standard sequence:

  1. Break the knowledge base into smaller text chunks, usually a few hundred tokens each.
  2. Use an embedding model to turn each chunk into a vector embedding that encodes its meaning.
  3. Store the embeddings in a vector database for similarity search.
  4. At question time, find the chunks closest in meaning to the question and add them to the prompt.
  5. The model writes the answer from the question and those chunks.

When is a RAG chatbot the right choice?

Situation RAG chatbot fits?
Answers must come from documents that change often Yes. Update the documents and the answers follow, with no retraining
Staff need to find the right page in a large set of runbooks Yes, if the answer links to its sources
The answer needs a calculation or a live system lookup Not alone. Add a tool or a fixed rule for that step
The documents are out of date or contradict each other Not yet. Clean them first
The bot would act on accounts, money or access Only with human approval of each action

A support team at a managed service provider (MSP), a company that runs IT services for other businesses, is a typical case. Technicians search runbooks while a customer waits. Our post on what an AI service desk can and cannot do for an MSP covers where this fits among other service desk tasks.

How do I build a RAG chatbot? A checklist

Example (made up for illustration): a technician asks, "How do we reset a client's VPN token?" The system retrieves the VPN runbook section on token resets, the model writes the steps, and the answer ends with a link to that runbook page. If the runbook has no such section, the correct reply is "I could not find this," not a guess.

Why do RAG chatbots give wrong answers?

Most failures happen at retrieval, before the model writes anything. Anthropic names a core weakness of traditional RAG: such systems "often destroy context." Its example is a chunk reading "The company's revenue grew by 3% over the previous quarter," which does not say which company or which period, so it is hard to retrieve for the right question.

The practical fixes follow from that:

How do I keep a RAG chatbot safe?

Putting documents into a prompt creates security questions that a plain chatbot does not have. The OWASP GenAI Security Project, which publishes guidance on AI application risks, covers two that matter here.

Untrusted text can carry instructions. OWASP says that "indirect prompt injections occur when an LLM accepts input from external sources, such as websites or files." A retrieved web page, email or uploaded file may contain text written to change what the model does. Among OWASP's listed mitigations in its prompt injection entry: "separate and clearly denote untrusted content," restrict the model's access privileges "to the minimum necessary," and require human approval for high-risk actions.

The knowledge base itself is a risk. OWASP's entry on vector and embedding weaknesses says these weaknesses create "significant security risks" in RAG systems. Its mitigations include "fine-grained access controls and permission-aware vector and embedding stores," validation pipelines that accept data only from trusted sources, and "detailed immutable logs of retrieval activities."

For a small team this becomes four rules:

  1. Only index documents you trust and can name an owner for.
  2. If staff see different documents, make the chatbot respect the same permissions. Never let one shared index expose a client's private notes to another client's technician.
  3. Give the chatbot read-only access at first.
  4. Keep logs so you can trace any answer back to its sources.

What does a RAG chatbot not do?

It does not make the documents correct, and it does not reason about facts that are not in them. It can still produce a fluent answer from the wrong passage. It is a search step plus a writing step, and each needs testing. Fix the documents and measure retrieval before you judge the model.

Frequently asked questions

What is the difference between a RAG chatbot and a normal chatbot?

A normal chatbot answers from what the model learned in training. A RAG chatbot first searches your documents and answers from the passages it finds, which lets it use information that is private or recent.

Do I need to train or fine-tune a model for RAG?

No. RAG adds your documents at question time, so you update the documents instead of retraining the model. Fine-tuning is a separate technique that changes the model itself.

Can a RAG chatbot stop making things up?

It reduces the problem but does not remove it. Tell the model to answer only from the supplied passages, show the sources, and let it say it could not find an answer.

How do I know if my RAG chatbot is working?

Run a fixed set of real questions after every change. For each, record whether the right document was retrieved and whether the answer matched it. Track the failures over time.

Where to go from here

Write down the one question set your team asks most often and the five documents that should answer it. That is your first test set. If you want to talk through connecting a language model to documents you already hold, the services page lists LLM and RAG work and links to a way to schedule a consultation.

Sources

All pages were read on 31 October 2026.