An AI assistant for your company knowledge base: how RAG works and why models make things up
An AI knowledge base assistant answers employees or customers from your company’s documents: policies, instructions, contracts, product descriptions. It works on the RAG pattern: first it finds suitable fragments in your sources, then a language model writes an answer based only on them and shows where it came from. The model is not retrained. Errors and invented facts never disappear entirely, but they can be reduced substantially: answering only from found sources, the right to say “not found”, a clean knowledge base and testing on real questions.
Open the software development page
What an AI knowledge base assistant is
Every company accumulates documents that employees constantly search for answers: how to process a return, what a customer on a given plan is entitled to, which clause of a contract governs deadlines. Usually some colleague knows the answer and gets interrupted ten times a day.
An AI assistant takes these questions over. An employee or customer asks in their own words, the assistant finds the right place in the documents, answers briefly and links to the source. The person can open the document and check instead of taking it on trust.
A knowledge base assistant is a specific and the most straightforward case of an AI agent. If the helper must not only answer but also carry out steps in your systems, it is an agent; the difference is explained in the guide AI agent for business.
How RAG works in plain words
RAG stands for retrieval-augmented generation — producing an answer based on data that has been found. The pattern has two halves: search and answer.
- Preparation. Documents are split into meaningful fragments — sections, clauses, paragraphs with headings. For each fragment a numerical representation of its meaning is computed, which is later used to find similar texts.
- Search. When a question arrives, the system looks for fragments close to it in meaning, even if the words in the question and the document differ. Semantic search is often combined with ordinary keyword search, which finds numbers, item codes and names more precisely.
- Answer. The model receives the question, the fragments found and an instruction: answer only from them and cite the source. If the answer is not in what was found, the assistant says so.
- Log. The question, the fragments found and the answer are saved — errors are analysed from them.
The main advantage of this pattern is that the model does not need to be retrained on your documents. Update the knowledge base and the assistant starts answering from the new version of the policy. That is how our approach works too: answers rely on current materials and show the source.
Why language models “hallucinate”
A language model does not store facts the way a database does. It continues text in the most plausible way. Without grounding, a plausible answer can turn out to be invented: a contract clause that does not exist, a wrong figure, a confident reference to something that is not there.
Typical reasons a knowledge base assistant gets things wrong:
- Search did not find the right fragment, and the model answered “from memory”.
- The base holds two versions of a document — old and new — and the wrong one was found.
- A fragment was taken out of context: the exception to a rule was in the next paragraph.
- The question was ambiguous, and the assistant did not ask what was meant.
- The model’s instruction allows it to fill gaps instead of saying “I don’t know”.
- The answer requires a calculation over a table, and the model does it “in its head” and makes a mistake.
Note that most of these causes have to do not with the model but with data and search. That is where errors should be fought first.
How to reduce AI hallucinations
| Technique | What it gives |
|---|---|
| Answer only from found fragments | The model does not rely on general knowledge where your rules are needed |
| Mandatory source link | A person checks the answer in seconds, and an error is visible immediately |
| The right to answer “not found” | The assistant hands the question to a person instead of inventing |
| Good document splitting | Fragments keep their heading and context, so exceptions are not lost |
| Semantic search plus keyword search | Finds both paraphrased questions and exact numbers and names |
| One current version of each document | No conflict between old and new policies |
| Calculations by a separate tool | A program computes the numbers, the model only explains the result |
| A set of test questions | Quality is measured before launch and after every change |
For important answers — those that go to a customer or affect money — human review is added. The assistant prepares a draft with links and an employee confirms it. As the log shows stable quality, review can be narrowed to difficult cases.
What to prepare before launch
What you give the assistant affects quality the most. Before work starts, it is worth collecting:
- A list of sources: which folders, systems and sections belong to the knowledge base and which do not.
- An owner of the base: a person responsible for keeping documents current and removing outdated versions.
- A list of real questions: a few dozen from correspondence, support and internal chats — with correct answers.
- Access rules: who may see which documents. A customer assistant should not answer from internal policies, and a department assistant should not answer from HR documents.
- Data requirements: which documents must not be sent to an external model. The options are covered in local vs cloud AI agent.
A perfect document structure is not required, but headings, version dates and clear file names help search considerably.
Where the assistant works
The assistant is built into the places where people already ask questions:
- a chat on the website or in a customer account — for customers;
- a Telegram bot — for customers and employees, with no separate app to install; more on the page Telegram bot development;
- the company’s internal portal or web application;
- email and CRM — when the assistant prepares draft replies for a manager.
The same assistant can work across several channels so a customer gets the same answers everywhere. It hands difficult questions to a person together with the conversation history.
How to check answer quality
Assistant quality is checked not by impressions but against a set of questions with known correct answers. For each question three things are checked:
- Whether the answer is correct in substance.
- Whether the right source is cited.
- Whether the assistant said “not found” when the answer really is not in the base.
The set is run before launch and after every change — a new version of documents, an edited instruction, a different model. That shows whether an improvement in one place broke something elsewhere. In the first weeks, questions from the log that the assistant got wrong are added to the set.
How to set up such a pilot and which numbers to record before starting is covered in AI implementation in business.
The same principle in our product
In JEEKSSHIRE 24 Legal the AI lawyer answers questions about a document and opens the relevant section instead of retelling the text in its own words. This is the same principle as in a good knowledge base assistant: the answer is tied to a specific place in the source, and the person immediately sees the clause it relies on. The decision stays with the person.
How to maintain the knowledge base after launch
An assistant is only as good as its knowledge base is current. Work does not end at launch; it becomes regular and small in scope:
- The base owner reviews key documents on a schedule and replaces outdated versions straight away instead of adding new ones alongside.
- Questions the assistant answered with “not found” are collected from the log: often this signals that the needed document simply does not exist and should be written.
- New documents receive access rights when uploaded, so internal materials do not end up in answers to customers.
- After noticeable changes — a new policy version, a different model, edited instructions — the set of test questions is run again.
- Errors found by employees are added to the test set so they do not recur.
This maintenance can be done in-house or handed to a contractor. How we work across all areas is described on the page about custom software development.
When a knowledge base assistant is not enough
- Actions are needed — create a request, change a status, send a document. That is a job for an agent with permissions and a log; how we build them is described on the page AI agent development.
- Questions require calculations over live data — stock, orders, payments. Then the assistant needs access to the system via an API, not just documents.
- There are few questions and they do not change. Sometimes an ordinary FAQ section or a bot with buttons is enough.
Frequently asked questions
What is RAG?
Retrieval-augmented generation is a pattern in which the system first finds suitable fragments in your documents, and the language model writes an answer based only on them and shows the source.
Do we need to train the model on our documents?
Usually not. The assistant is given semantic search over the knowledge base, so updating the documents is enough — the model does not need retraining.
Can hallucinations be eliminated completely?
Not completely. But they are reduced substantially: answers only from found fragments, a mandatory source link, the right to say “not found”, a clean base and human review for important answers.
Which documents suit a knowledge base?
Policies, instructions, contracts, product descriptions, support answers. What matters is that the base holds one current version of each document and that someone is responsible for it.
How does the assistant separate access?
By rules the company sets: a customer assistant sees only public materials, an internal one sees its own department’s documents. Every request and the sources found are written to a log.