Skip to main content

How Does a Chatbot Understand Me? - RAG Made Simple

· 5 min read
Minisoft AI Platform Tech Blog Author

TL;DR RAG retrieves materials related to the question first, then lets the LLM answer from that evidence. This matters for enterprise chatbots that must reflect current internal documents and policies.

Have you ever asked, "What is our vacation policy?" and seen a chatbot answer with the correct internal rule? A public LLM does not know your company's private documents, so how is that possible? The key is RAG, retrieval-augmented generation. Let us explain it with a librarian analogy.

Why Not Just Ask the LLM?​

LLMs are trained on a huge amount of text. They know plenty of general knowledge and public information. But they are weak at questions like these:

  • Your company's internal policies, which were not in training data
  • Product information announced yesterday, after the model's training cutoff
  • Private documents and internal manuals, which should never be in public training data

For these questions, an LLM tends to respond in two bad ways.

1. It Says It Does Not Know​

If it honestly says, "Sorry, I do not have that information," that is at least safe.

2. It Makes Up Something Plausible​

The real problem is that an LLM can make up a convincing answer. It sounds like it knows, but the answer is fabricated. This is called hallucination.

The Librarian Story​

Imagine a friend who is an expert in a field but knows nothing about your company. Asking that friend "What is our vacation policy?" is like asking an LLM directly.

Now take that friend to a library. The librarian finds the company policy book and hands it over. "The answer should be in this book." Your friend reads it and answers, "Vacation starts after one year of employment, with 15 days, and requests are submitted this way."

That is the core idea of RAG.

  1. A user asks a question -> the librarian finds related materials
  2. Those materials -> are handed to the expert, the LLM
  3. The LLM answers from the materials -> the answer becomes grounded

How RAG Works​

Let us look at the steps more concretely.

Step 1: Prepare the Materials​

For a librarian to find things quickly, the shelves need to be organized. RAG is the same.

All company documents, manuals, policies, FAQs, and emails are split into small chunks. Each chunk is converted into a bundle of numbers called a vector. That vector represents the meaning of the sentence.

Sentences with similar meaning become similar numbers. "How to request vacation" and "How to use annual leave" use different words but have close meaning, so their vectors are close.

Step 2: Find Similar Materials When a Question Arrives​

When a user asks, "How do I use vacation?", the question is also converted into a vector. The system then searches stored document vectors for the closest meanings.

This type of database is called a vector database. It works like a library catalog. A paragraph about the vacation request process is retrieved.

Step 3: Give the LLM the Question and the Materials​

Now the LLM receives a request like this:

"Answer the user's question using the following source.

[Source] Internal vacation requests are submitted through HR -> Vacation Request...

[Question] How do I use vacation?"

The LLM reads the source and answers in a way the user can understand.

"Log in to the groupware system, then go to HR -> Vacation Request. First choose the vacation type..."

If the source does not contain an answer, the system can be configured to say, "This information is not in the provided materials."

Why Combine Search and Generation?​

Because each approach has limits.

Traditional search, such as an internal wiki search

  • Requires the exact keyword
  • Searching "vacation" lists every related document, and the user has to read them
  • Does not produce a natural answer

LLM alone

  • Can talk naturally
  • Does not know your company information
  • Can produce plausible false answers

RAG = search + generation

  • Retrieves your company's information accurately, which is the strength of search
  • Turns it into a readable answer, which is the strength of generation
  • Reduces false answers because the response is grounded in sources

Where Is It Used?​

Internal Knowledge Chatbots​

New employees can ask a chatbot instead of searching the internal wiki. Everyday questions such as "How do I settle travel expenses?", "My VPN is not connecting", or "How do I reserve a meeting room?" can be answered immediately.

Customer Support​

When customers ask product questions, RAG searches manuals, FAQs, and past support records to answer. It works 24 hours a day and passes complex issues to human agents.

These fields depend on finding accurate information from large sets of regulations, cases, papers, or policies. RAG can greatly reduce the time spent searching and summarizing.

How to Use RAG Well​

1. The Materials Must Be Clean​

If bad materials are retrieved and handed to the LLM, the answer will also be bad. Internal documents need to be organized for RAG to work well.

2. Find the Right Amount of Material​

Too little context makes the answer incomplete. Too much context makes the LLM miss the point. Usually three to five paragraphs is a good starting point.

3. Show Sources​

Showing sources, such as "This answer is based on Internal Vacation Policy v3.2," helps users trust and verify the answer.

Closing​

RAG is not magic. It automates something people already do: search for the right material, read it, and answer from it. Minisoft is using RAG in internal knowledge systems and customer support chatbots while learning every day how AI can fit into real work.

References​

Reactions and comments

Sign in with GitHub to comment and leave a reaction (like). Comments and GitHub usernames are public; editing, deletion, and reporting are handled through GitHub Discussions.