Cloud Computing · RAG

A company knowledge base with AI (RAG): an assistant that answers from your documents

Remote Admin SysOps Team·November 23, 2026·22 min read

RAG, short for retrieval-augmented generation, is a way of building an AI assistant that first finds the right passages in your company’s documents and then answers on that basis, pointing to the source. The language model does not have to “know” your procedures, contracts or manuals, and every answer can be checked against the document it came from. Whether such an assistant is useful depends on document preparation, permissions and the way quality is measured, and far less on the model itself.

A company knowledge base built on RAG addresses a problem many organisations share: the knowledge exists, but it is scattered across network drives, the intranet, mailboxes and the heads of a few experienced people. Below we describe how such an application works on the inside, when it makes sense and when ordinary search is enough, and what to ask a contractor. We write from the perspective of a team that designs and builds custom web and mobile applications, including applications with AI modules.

Legal status as of November 2026. This article is for information only and is not legal or tax advice.

What is RAG and how does an assistant based on company documents work?

RAG is an architecture in which the application first searches company documents for passages that match the question and only then passes them to a large language model (LLM) with an instruction to answer solely on their basis. The model acts as an editor who reads the material it has been given and writes the answer. It is not the source of knowledge about the company.

This distinction has practical consequences. A general-purpose model knows language and common knowledge from the data it was trained on, but it does not know your pay policy, your price list or your complaints procedure. You can fine-tune a model on company documents, but then every change to a procedure means repeating that operation. It is also hard to remove a single document from a fine-tuned model, or to restrict access to it to selected people. In the approach described here, updating the knowledge simply means updating the document in the knowledge base.

The application works in two phases. The first is building the knowledge base, done at the start and repeated whenever documents change (steps 1–4). The second is handling a single question (steps 5–8).

  1. Collecting documents from their sources. The application connects to a network drive, the intranet, a document management system or a ticket database and fetches the selected collections.
  2. Extracting text and structure. Content, headings, tables and lists are read from the files. Scans first need optical character recognition (OCR) or reading by a vision model.
  3. Splitting into chunks. Each document is divided into parts that hold together in meaning, usually along headings and paragraphs.
  4. Indexing. Every chunk receives a vector representation (an embedding), which is a numerical record of its meaning, and goes into a vector database together with metadata: title, version, date, owner and permissions. A classic full-text index is usually built alongside.
  5. Retrieval. When a question is asked, the application finds the chunks closest to it in meaning and immediately discards those the person asking has no access to.
  6. Selection. The results are scored again and reordered, and only the best few, or a dozen or so, reach the model.
  7. Answer. The model receives the question, the selected chunks and an instruction: answer on the basis of this material, give your sources, and if the material does not contain the answer, say so.
  8. Logging. The question, the chunks used and the answer are written to a log that serves quality control and accountability.

Semantic search differs from keyword search. An employee who asks about “time off for my wedding” gets the passage of the leave policy on special leave, even though the question shares no words with the document. Procedure numbers, product codes and proper names, on the other hand, are found more reliably by a classic keyword index. That is why mature deployments combine both methods, which is known as hybrid search.

When does RAG work better than a plain chatbot?

An assistant with a knowledge base works better than a plain chatbot when the answer has to follow from your company’s documents, has to be current and has to be verifiable. A plain chatbot, meaning a general-purpose model with no access to company material, will answer any question fluently, but on internal matters it can only guess. Classic search, in turn, finds files but gives no answer: it leaves the employee with a list of documents to read.

Criterion Plain chatbot (general-purpose model) Full-text search Assistant with a knowledge base
Source of the answer The model’s general knowledge A list of files containing the search terms Identified passages of company documents
How current it is As of the period the model was trained on As current as the file index As current as the last synchronisation of the knowledge base
Verifiability No source indicated Full, but the reading is left to the user A link to the passage with every answer
Permissions Not applicable Usually inherited from the file system Must be designed and enforced at retrieval
Form of the result A ready answer A list of documents A ready answer with sources
Main risk An answer that sounds credible but contradicts company rules The employee does not find the document because they used different words An answer based on an outdated or poorly chosen passage

A chatbot on company documents: example questions

The situations below are illustrative examples and do not describe specific deployments. They show what kinds of questions fit this architecture well.

  • Finance department. “Who approves a purchase invoice when the amount exceeds the department manager’s limit?” The assistant quotes the provision from the document workflow procedure and points to the clause that describes the approval path.
  • Customer service. “What is the deadline for handling a complaint from a customer with a service contract?” The answer comes from the general terms and the contract template, and the agent sees both sources.
  • Field service and production. “How do I carry out a periodic inspection of the device after a filter replacement?” A technician in the field gets the steps from the work instruction on their phone.
  • A new employee. “How do I settle the expenses of a business trip abroad?” Instead of asking three people, they get the relevant passage of the business travel policy and a link to the form.

These questions have one thing in common: the answer is written down somewhere, and the difficulty lies in finding it. A broader overview of similar uses, together with the automation of documents and orders, is in our article on ten use cases for AI in business processes.

When a simpler solution is enough

An assistant is not needed everywhere. If employees keep asking about the same dozen or so matters, a well-written page of answers will serve them better. If the questions concern figures from the ERP system or the accounting software, the right tool is a report or a database query. If there are few documents and they are sensibly named, full-text search is enough. An assistant with a knowledge base pays off where the collection is large, inconsistent in wording and frequently changed, and where a wrong or late answer has a noticeable cost.

How do you prepare documents for a company knowledge base?

Preparation starts with selecting and tidying up the sources, not with uploading everything that sits on the drive. The assistant answers only as well as the material it has been given. If the knowledge base contains three versions of a policy, two of them outdated, the model has no grounds for choosing the right one and will quote one version one day and another the next.

Tidying up consists of four activities: listing the sources and naming an owner for each collection, removing duplicates and working drafts, marking archived documents, and deciding what does not go into the knowledge base at all. Personnel files, private correspondence and notes that nobody has approved usually stay out. The next step depends on the type of material.

Type of material Typical problem What has to be done before indexing
Scans without a text layer No text to search, reading errors Character recognition or reading by a vision model, quality check on a sample
Tables, price lists, rate schedules Once converted to plain text, rows lose their link to the column headers Preserve the table structure, store every row together with its headers
Presentations and diagrams Content stored as graphics, slogans without context Describe the slides, attach the speaker notes, sometimes drop this source
Long policies and contracts A passage taken out of context changes its meaning Split along clauses, attach the document title and the heading path to every chunk
E-mail threads and tickets Repeated quotations, signatures, decisions spread over many messages Remove repetitions, index the resolution instead of the whole discussion
Spreadsheets Numbers without a description, meaning that depends on the sheet layout Usually a separate path: structured data in a database instead of text chunks

The second element of preparation is metadata. Every chunk should carry information about which document it comes from, who owns it, since when it has applied, which unit it concerns and who may read it. Metadata makes it possible to narrow the search, for example to the procedures currently in force in the logistics department, and to show the user how far the source can be relied on.

The third element is the way documents are split into chunks. A chunk that is too short loses its context: the sentence “the deadline is 14 days” is useless if nobody knows what it refers to. A chunk that is too long blurs the meaning and makes accurate retrieval harder. The splitting method is matched to the type of documents and checked against the test questions we describe below. For contracts and policies, the same principles apply as in the analysis of contracts and legal documents with AI that we have described separately.

Permissions: the assistant must not show a document the user is not allowed to see

The rule is simple: the assistant may use only those documents that the person asking could open themselves. This applies to a single sentence as well. If an answer summarises a salary amendment or the minutes of a board meeting, a disclosure has taken place, even when the file itself was never shown.

This rule cannot be enforced by an instruction given to the model. “Do not reveal HR documents” is a request that a suitably worded question can get around. The control has to work earlier, at the retrieval stage: chunks the user has no right to see never reach the model at all. A model cannot reveal text it has not received.

In practice this means several design decisions:

  • Sign-in through the company identity system. The assistant recognises the user and their groups in the same way as other systems do, preferably through single sign-on (SSO).
  • Permissions inherited from the sources. Access rights to a chunk follow from the rights to the document in the system it comes from. No second, manually maintained list is created.
  • Fast revocation of access. When an employee changes department or leaves the company, the change should take effect with the very next question, without waiting for a nightly synchronisation.
  • Protection of the index itself. The vector database contains the content of the documents, so it needs the same safeguards as they do: encryption, control of administrative access and backups.
  • Care with the question log. Employees’ questions can be sensitive. It has to be decided who can view them and how long they are kept.

Company documents often contain personal data of employees, customers and business partners. When building the knowledge base, you therefore have to take the GDPR principles into account: data minimisation and purpose limitation (Article 5) and security of processing (Article 32). The full text of the regulation is available on EUR-Lex. The simplest way to minimise data is not to load collections into the knowledge base that are not needed to answer questions.

The threats specific to this architecture, including weaknesses of vector search and instructions injected through the content of documents, are covered by the OWASP Top 10 for LLM Applications. We discuss the list in a separate article on AI application security. Before the assistant is made available to a wider group, we recommend penetration testing, which checks, among other things, whether the content of other people’s documents can be extracted.

Citations and sources: how do you know the assistant’s answer is true?

You know it when every statement in the answer has a link to a specific passage of a document that the user can open with one click. Citations are not decoration for the interface. They are the main control mechanism, because they shift the burden of trust from the model to a document the company itself has approved.

A well-designed answer therefore contains the answer text, a list of sources with title, version and effective date, and a highlighted passage on which a given sentence is based. If retrieval returned nothing relevant enough, the assistant should say that it did not find an answer in the available material and name the person responsible for the topic. A refusal like this is a correct outcome for the application.

A link alone does not yet settle whether the answer agrees with the source. The model can point to the right document and still distort its content, for example by leaving out an exception described in the next sentence. The application can therefore additionally check whether the cited passage really contains what the answer claims, and flag sentences that have no support. The techniques for limiting such errors, from enforced answer structure to confidence thresholds, are described in our article on how to prevent AI hallucinations in business applications.

That leaves the question of habits. Where there are financial or legal consequences, the employee should read the cited passage before making a decision. The interface should make this easy: the source opens at the place of the citation, not on the first page of a hundred-page file.

How do you keep the knowledge base up to date?

Two things keep it up to date: automatic synchronisation with the sources and clearly assigned responsibility for the content. The first is a technical task, the second an organisational one, and it is the second that fails more often.

On the technical side, the application detects changes in the sources and processes only what has changed: a new document goes into the index, a changed one replaces the previous version, and a deleted one disappears from the results. Deletion tends to be overlooked, yet a document withdrawn from the intranet that still remains in the index does more harm than no answer at all. Archived versions can be kept, but clearly marked and outside the default search scope.

On the organisational side, every collection needs an owner who is responsible for its correctness and for the review date. The application itself helps here. A report of questions the assistant found no answer to shows the gaps in the documentation. A report of the most frequently cited documents shows which procedures need particular care, because the largest number of answers rests on them.

Role Responsible for
Content owner (department manager, subject expert) Keeping the documents in their area correct and up to date, reference answers for tests, response to reported gaps
Knowledge base administrator List of sources, synchronisation schedule, review of quality reports and user feedback
IT department Identity system and permission groups, access to sources, runtime environment
Person responsible for security and data protection Scope of personal data in the knowledge base, retention rules for the question log, permission reviews
Users Checking sources before important decisions, reporting wrong and missing answers
Application contractor Development, regression tests after changes, operational monitoring and updates

How do you assess the assistant’s quality before rollout?

Quality is assessed on a test set made up of real questions from employees, for which the company’s experts have prepared reference answers and identified the source documents. The impression left by a few successful attempts in a demo is not a measurement. The set should include easy questions, hard ones, and questions the knowledge base deliberately contains no answer to.

The assessment is carried out separately for several areas, because the errors have different causes and need different fixes:

  • Retrieval. Was the right chunk among the results passed to the model? If not, the problem lies in document preparation, chunking or search configuration, and changing the model will not improve anything.
  • Answer. Is the content consistent with the source and complete, and does it cite the right passage? Here the instruction for the model and the model itself matter.
  • Refusal. When there is no source, does the assistant admit that it does not know instead of composing an answer from general knowledge?
  • Permissions. Does a test user without access to a given collection really get no answer based on that collection, however the question is phrased?

The test set stays with the project for good. Every change, whether a new model version, a different chunking method or the addition of another source, ends with the tests being run again and the results compared with the previous ones. Without this, a fix in one place can quietly make answers worse in another.

The second step is a pilot in one department. Users mark answers as accurate or wrong with one click, and the project team regularly reviews the negative ratings and the unanswered questions. We agree with the client on the quality threshold at which the assistant goes out to the whole company before the pilot starts. We do not quote universal values, because they depend on the documents and on how costly a mistake is in the given process.

The limits of RAG: what AI enterprise search will not do well

This architecture has limits that are better learned before ordering than after rollout. Most of them stem from the fact that the model sees a few selected chunks, not the whole collection.

  • Cross-cutting and counting questions. “How many contracts expire next quarter?” requires going through all the contracts, so a few retrieved chunks are not enough. The solution is to extract data from the documents into a register beforehand (parties, dates, amounts) and to route such questions to the register.
  • Calculations. A language model is not a calculator. If the answer requires arithmetic, ordinary code should do it, and the model should at most describe the result.
  • Contradictory documents. When two procedures say different things, the assistant will not decide which takes precedence unless the metadata makes it clear. It can, however, show both and point out the discrepancy, which is useful information for the content owners.
  • Unwritten knowledge. If an arrangement exists only in the team’s practice, the assistant does not know it. Work on a knowledge base often reveals how many rules have never been written down.
  • Drawings, diagrams and complex tables. Content stored as graphics needs separate processing, and the results tend to be weaker than for text.
  • Tasks on a whole document. Summarising a long contract or comparing two versions of a policy is a different mode of work, in which the model receives the entire text.

Add to this list the typical organisational mistakes: uploading a whole drive without selection, postponing permissions until later, having no content owners, having no test set, and expecting the assistant to replace an expert in ambiguous matters. The assistant shortens the path to written knowledge, but it does not make decisions and does not interpret regulations on the company’s behalf.

Where does the model run and what happens to the data?

The model can run at an external provider, which the application reaches through an API, or on a server controlled by the company, and the choice depends mainly on the confidentiality of the documents and the scale of use. The difference lies in where the questions and the chunks passed to the model with every answer end up. The model that creates the vector representations has to be taken into account as well: if it runs at an external provider, the entire content of the knowledge base goes to that provider during indexing.

If the model runs at an external provider and the documents contain personal data, you need a data processing agreement (Article 28 GDPR) and a check of where the data is processed, how long it is kept and whether it may be used to train models. The alternative is an open-weight model running on a GPU server in a Polish data center, so that the content of the documents does not leave Poland and stays inside the EU. We compare both options in our article on whether to choose an AI model in the cloud or on your own server.

A separate matter is the AI Act, that is Regulation (EU) 2024/1689. Searching a knowledge base and answering questions about procedures is, as a rule, not a high-risk use. It would be different if the same assistant were to be used to evaluate employees or screen job candidates, because these are examples of high-risk areas, for which the obligations under Annex III apply from 2 December 2027. The classification is checked separately for each use case. You will find more on this in our article on AI and company data in the EU.

What does rolling out an AI assistant for business look like, step by step?

A rollout starts with one well-defined area of knowledge and one group of users, and ends with the system being handed over to maintenance with agreed roles. An attempt to cover the whole company at once usually gets stuck in tidying up documents and agreeing permissions.

  1. Choosing the area. For example finance procedures, service documentation or HR policies. The criterion: many recurring questions and documents in decent condition.
  2. Listing sources and permissions. We establish where the documents come from, who owns them and who may read them.
  3. The set of test questions. The company’s experts prepare it before the first version of the application exists.
  4. The first version. A working application with a limited scope is built: indexing, retrieval, answers with citations, sign-in through the company identity system.
  5. Measurement and fixes. We run the tests, analyse the errors and improve document preparation.
  6. The pilot. The selected department uses the assistant in daily work and rates the answers.
  7. Extension and maintenance. Further sources and departments are added, and the test set grows together with the knowledge base.

This sequence is a specific case of the process we describe in our article on custom app development step by step.

Where employees meet the assistant

An AI assistant for business does not have to be a separate page with a chat box. It can work as a web application, a window in the intranet, a mobile application for field staff, or a feature in a system the team already works in, for example the ticketing panel. Where answers go out to customers, the principles are similar, but the requirements for tone and for refusal are higher. We wrote about this when discussing an AI chatbot in customer service. We choose the technology to fit the project, because it depends on the sources, the number of users and the place where the model is to run.

What drives the cost and what to ask a contractor

The cost is driven above all by the number and variety of sources, the condition of the documents, the complexity of permissions, the number of integrations, the place where the model runs, and the required level of quality and availability. The chat window itself is the smallest part of the work. When you talk to a contractor, ask a few questions:

  • At which point does the application check permissions, and how quickly does revoking access take effect?
  • How will quality be measured, and who will prepare the test set?
  • What happens when the documents do not contain the answer?
  • How does the application handle a document being deleted or changed at the source?
  • Where do the questions and document chunks go, who stores them and for how long?
  • Can the model be replaced without rebuilding the application?
  • Who is responsible for monitoring, backups and updates after rollout?

FAQ: frequently asked questions

What is RAG in simple terms?

RAG is a way of running an AI assistant in which the answer is produced from document passages retrieved from the company knowledge base, not from the model’s memory. The application first finds the matching passages, then passes them to a language model, which writes the answer and gives its sources. As a result, knowledge is updated by changing a document.

What is the difference between RAG and training your own AI model?

With training or fine-tuning, the knowledge is fixed in the model and every change means repeating the process. With retrieval-augmented generation, the model stays unchanged and the knowledge sits in a document base that can be updated continuously and covered by permissions. In uses such as a company knowledge base, this is usually simpler to maintain and easier to verify.

Can an AI assistant for business use confidential documents?

Yes, provided that permissions are enforced at the retrieval stage and not by an instruction to the model. A user receives answers based only on documents they have access to themselves. For particularly sensitive data, it is reasonable to consider a model running on a server controlled by the company.

Can a chatbot on company documents get things wrong?

It can. The most common causes are an outdated document in the knowledge base, a poorly chosen passage, or an exception described in the source being left out. The risk is reduced by citations with every answer, refusal when there is no source, a test set and regular review of user ratings.

Does data from a company knowledge base go to the model provider?

That depends on the architecture. If the application uses a model through an external provider’s API, the provider receives the questions and the document passages used in the answer, so you need to check the data processing agreement, the place of processing, the retention period and the rules on using data for training. If the model runs on the company’s own server or on a leased GPU server, the data stays in a controlled environment.

Will AI enterprise search replace the intranet and the document management system?

No, because it does not store or approve documents itself. It is an access layer to knowledge that already exists in those systems, and it takes both content and permissions from them. The better the sources are kept, the better the answers.

How much does a company knowledge base with AI cost and how long does it take to roll out?

Cost and schedule depend on the number of sources, the condition of the documents, the complexity of permissions, the integrations and the place where the model runs, so we set them individually. The quote is free and without obligation. We usually suggest starting with one area of knowledge and a pilot, which lets you judge the effect before committing a larger budget.

A free quote for your company AI assistant

We design and build applications with a company knowledge base: from document preparation and the permission model, through retrieval and answers with citations, to integrations with the systems your team works in. We can host the application in Polish Tier III data centers, so the data stays in the EU, or run it on your infrastructure, with 24/7 administration and monitoring, backups, and security testing carried out by our own penetration testers. The model can run on our GPU servers in Poland or through an API, if you prefer. You receive the source code and the documentation, and copyright, licence and repository access are set out in the contract.

We start with a conversation about what knowledge your employees look for and what condition the documents are in. On that basis we prepare an estimate of scope, schedule and budget. The quote is free and without obligation. You will find the details of the offer on our web and mobile app development page, and you can send an enquiry through the contact form.