Skip to main content
AG·SORA
Technology

Chatbot AI Powered by Company Knowledge with RAG: Accurate Answers from Your Documents

Published 10 min readWritten by agsora.tech
AG·SORA / BLOGAG·SORATechnologyChatbot AI Powered byCompany Knowledge with RAG:Accurate Answers from YourDocumentsagsora.tech
In this article

Many businesses try a general purpose AI chatbot to answer customer or employee questions, then end up disappointed. The answers sound convincing but do not match the company's return policy, quote prices that have since changed, or invent procedures that never existed. The cause is simple: large language models are trained on general data, not on your internal documents, and they tend to answer even when they do not know.

Retrieval augmented generation, or RAG, is the most widely used approach to this problem. Instead of relying on the model's memory, the system first searches for relevant pieces of company documents, then asks the model to compose an answer based on those pieces. The result is an assistant that answers from your own sources and can show where an answer came from.

This article explains how RAG works in plain language, the use cases that make sense for small and medium businesses, the steps to build it, common mistakes, and how to protect data and measure answer quality. The aim is to help you judge whether RAG is worth trying and what to prepare before starting.

Summary

  • RAG first retrieves relevant documents, then asks the model to answer only from them
  • Answer quality depends heavily on the quality and tidiness of the source documents, not only the model
  • Safe starting cases: a customer help centre, internal SOP Q&A, and product document search
  • Show sources with every answer and provide a handoff to a human when the system is unsure
  • Restrict data access to user permissions and measure quality with a fixed set of test questions

Why general AI chatbots often get business questions wrong

A language model works by predicting the next word from patterns in its training data. It has no access to your price list, your latest warranty policy, or your distributor discount structure unless that information is given to it. When there is no information, the model still tries to compose a plausible sounding answer. This phenomenon is often called hallucination and is a real risk in customer service.

The second problem is stale knowledge. What is inside a model stops at a point in time, while a business keeps changing: new products, seasonal promotions, revised procedures. Retraining a model every time a document changes is expensive and impractical for most companies.

RAG separates the two concerns. Knowledge lives in a document base that is easy to update, while the model is used only to understand the question and string the language together. When the return policy changes, you simply update the document and the next answer follows immediately.

Lines of coloured code on a dark screen with partly blurred focus
Behind a simple looking assistant sit document retrieval, context assembly, and answer generation.

How RAG works in plain language

Picture a smart new staff member who has not yet memorised the company's rules. Each time a question arrives, they open the filing cabinet, pull out the few most relevant pages, read them, and answer while naming the page they relied on. RAG imitates that habit in three steps.

  1. 01Preparation: documents are split into small chunks, for example a few paragraphs, then each is turned into a numeric representation called an embedding and stored in a vector database or search index
  2. 02Retrieval: when a user asks, the question is converted the same way, and the system fetches the chunks closest in meaning, often combined with ordinary keyword search
  3. 03Answer composition: the chosen chunks are sent to the model together with the question and firm instructions, namely to answer only from the context and to admit ignorance when the context does not contain the answer

Search by meaning differs from keyword search. The question "can I return an item I've already used" can find the section titled "return terms" even though the wording is not identical. That is why many systems use hybrid search, a blend of meaning and keywords, so that specific terms such as product codes are still found precisely.

Use cases that make sense for a business

A customer help centre is a common starting point. Repeated questions about service hours, shipping costs, how to claim a warranty, or order status can be answered from help articles that already exist. The support team's load shrinks, and customers get answers outside working hours without waiting in a queue.

Internal Q&A is valuable too. New employees often ask the same things: how to request leave, what the travel expense limit is, who approves purchases. An assistant that answers from the handbook and SOPs speeds up onboarding and reduces interruptions for HR and line managers.

Product and technical document search helps sales teams and technicians. Hunting for a specification among hundreds of catalogue pages or manuals can take time. An assistant that finds the right section and links to it lets staff answer customers faster with correct information.

Conversely, avoid starting with high risk cases such as giving legal or medical advice or automated credit decisions. Begin with cases where the answer is easy to verify and the cost of a mistake is small, then widen once you understand how the system behaves.

Document quality is the ceiling on answer quality

RAG does not repair bad documents. If policies contradict each other, there are three different versions of an SOP, or information is written vaguely, the assistant will mirror that mess. Tidying documents is often the largest and most valuable job in a RAG project.

Steps to build a RAG assistant

1. Define the scope and the authoritative sources

Pick one narrow domain, for example questions about shipping and returns. Decide which documents are the source of truth, who owns them, and when they were last checked. Documents without an owner tend to go stale and mislead.

2. Prepare and clean the documents

Convert documents to clean text. Remove duplicates, fix titles so they are descriptive, and mark effective dates. Tables and image attachments need special attention because they often break when converted to text. Metadata such as category, language, and access level helps filtering at the retrieval stage.

3. Chunk documents sensibly

Chunks that are too small lose context, while those that are too large bring noise and waste model capacity. Splitting along natural structure, meaning headings and subheadings, is usually better than cutting at a fixed length. Leave a little overlap so important sentences are not cut off.

4. Design instructions and behaviour when it does not know

The instructions to the model must be firm: answer only from the context provided, cite the source, and if the information is absent, say so plainly and offer to connect to staff. An honest "I don't know" is far better than a convincing invented answer.

5. Build the interface and the human handoff

Show source citations so users can check. Provide a button to rate answers and a button to talk to staff. For customer service, this handoff matters so complicated or emotional conversations are not held by a machine.

A man working in front of two monitors showing code and an interface layout
The interface, retrieval, and evaluation need to be designed together, not only the language model.

Common mistakes

  • Indexing every document at once without sorting, so outdated documents and drafts become answer sources
  • Not storing document dates and versions, so the system quotes an old policy
  • Assuming a bigger model will fix poor retrieval, when the problem often lies in the chunk fetching stage
  • No ongoing evaluation, so quality drops after documents change go unnoticed
  • Opening access to documents that should be restricted, such as salary data or contracts, to all users
  • Promising customers an assistant that "knows everything" when its scope is limited to specific domains

Data security and privacy

Company documents often contain sensitive information. Before sending document content to a third party model service, understand the provider's policy on data storage and use, and whether your data is used to train models. Choose a configuration that fits the sensitivity level, including options to deploy in your own environment where needed.

Apply access control at the retrieval stage, not only in the display. That means the system may only fetch chunks the asking user is entitled to read. Otherwise the assistant can leak restricted document contents through answers even if the user has no access to the original documents.

Also watch for prompt injection, where text in a document or user message tries to instruct the model to break the rules. Treat document content as data, not commands, limit the actions the assistant can take, and do not give it write or delete access without human approval. For personal data, refer to the data protection rules currently in force and consult your legal adviser.

Measuring answer quality

Assemble a set of test questions, for example 50 to 100 real questions from the support team with correct answers and the reference documents. Run the set every time you change the documents, the way text is chunked, or the model instructions, and compare results. Without a fixed benchmark, improvement is only impression.

Evaluate two things separately. First, whether retrieval finds the right chunks. Second, whether the answer stays faithful to those chunks. This separation helps locate the source of a problem: failed retrieval is fixed through documents and chunking, while a drifting answer is fixed through instructions and model choice.

Once users are on it, monitor unanswered questions, negative ratings, and how often conversations move to staff. Failed questions are clues to which documents are missing. A short weekly review is usually enough to keep quality rising.

Cost and the build or buy decision

RAG cost has several components: model calls, storage and search, initial engineering, and the recurring work of tidying documents. Model usage is usually billed by the volume of text processed, so cost follows the number of questions and the length of context. Estimate from your own question volume and test with a small pilot before committing.

Whether to build your own or use a ready made product depends on need. Ready made products are fast and cheap for standard cases such as a help centre. Custom development makes sense when you need to connect directly to ERP, CRM, or order data, have complicated access rules, or need workflows that general products do not offer.

Connecting the assistant to business systems

The most valuable next step is combining RAG with transaction data. The question "where is my order" is not answered from documents but from the order system. The assistant can be given limited read access to ERP or CRM through an API, so it answers order status, stock, or invoice balance accurately. Start with read only access and apply user authentication before showing personal data.

For actions that change data, such as cancelling an order or changing an address, add explicit confirmation and an audit trail. The more authority you give, the stricter the testing and oversight required.

A simple illustrative example

As a hypothetical picture, a home goods store gathers 30 help articles on shipping, returns, warranty, and payment. The team tidies them, adds effective dates, then builds an assistant that answers from those articles and shows source links. Out of scope questions, such as complicated complaints, are automatically passed to staff with a conversation summary.

Each week the team reads the list of questions that went unanswered, writes new help articles for gaps that recur, and reruns the test set. Over several months the assistant becomes more useful not because the model was swapped but because the documents grew more complete and tidy. This is the realistic pattern: value grows from the discipline of managing knowledge.

Closing

RAG is not magic and not merely plugging a model into a folder of documents. It is a system that combines knowledge management, retrieval, firm instructions, access control, and continuous evaluation. Designed well, the result is an assistant that answers from your sources, shows its references, and is honest when it does not know.

Start small: one domain, tidied documents, a set of test questions, and a human handoff. Measure the results, improve the documents, then expand step by step. That way you get real benefit without staking your reputation on invented answers.

Want an AI assistant that answers from your business documents and data?

The AG·SORA team can help design a RAG based assistant connected to your ERP, CRM, or help centre, complete with access control and quality evaluation. The first consultation is free and carries no obligation.

Free consultation

Free checklist: choosing a software house

24 points to evaluate a vendor before you sign. Can be saved as a PDF.

Get the checklist

Ready to build a system that grows with your business?

Discuss your needs with the AG·SORA team, no cost, no commitment.