AI

An AI assistant over company documents: how it works and why it sometimes fails

How an assistant finds answers in company documents, why it cites sources, what usually breaks it and how to test it with your own questions.

An AI assistant over company documents answers questions from your policies, contracts, price lists and manuals by first finding the related passages and only then writing an answer from them, with its source cited. It fails mainly on messy and out-of-date documents, on badly set permissions and on questions that require going through everything at once, such as totals and counts. The technique is called retrieval-augmented generation, or RAG for short. In plain terms: look it up first, then write the answer.

Below I explain how it works, why a good answer always shows its source, what most often breaks such an assistant and how to test it before you start relying on it.

How it works: a librarian and a writer

A document assistant has two parts. The first is search, which acts as a librarian. The second is a language model, which acts as a writer.

  1. Preparation. Documents are split into shorter passages and stored in a search index. Modern search can match by meaning, not just exact words, so it finds the passage about “annual leave” even when you ask about “time off”.
  2. Retrieval. When you ask a question, the system first finds the handful of passages most closely related to it.
  3. Answer. The language model receives your question together with those passages, plus an instruction to answer only from them and say where each point comes from.

The key point is that the model doesn’t “learn” your documents. It reads them only at the moment you ask. When a document changes, updating the index is enough; there’s no need to retrain the model.

The term was introduced by researchers in a 2020 paper. Today, major providers describe it as the standard way to ground a language model’s answers in your own content.

When a document assistant is worth it

Not every business needs one. It makes most sense when most of the following are true:

  • there are so many documents that people get lost in them and ask colleagues instead,
  • the same questions keep coming up, typically from new starters, sales or customer support,
  • the answer can be found in one or a few specific places in the text,
  • the documents have a clear owner who keeps them up to date.

If people keep asking the same ten things, a well-written FAQ page may be enough. It costs less and never makes anything up.

Why answers cite their sources

A link to the source isn’t decoration. It is the main safeguard of the whole approach.

  • Verification in one click. Open the cited document and see whether it really says what the assistant claims.
  • Visible provenance. If the assistant quotes last year’s price list, you notice straight away, not when a customer points it out.
  • An honest “I don’t know”. A well-configured assistant says it couldn’t find the answer in the documents rather than inventing one. That doesn’t happen by itself, though. It has to be required and tested.

Even with citations, the model can misread a source or summarise it inaccurately. Citations make checking easier; they don’t replace it.

What most often breaks it

Messy documents

Scanned PDFs without a text layer, tables pasted in as images, five versions of the same policy called “final”, “final2” and “final_REALLY”. Search then finds the wrong version, or nothing at all.

Answers can never be better than the material behind them. Tidying up the documents is part of the project, not a side task.

Permissions

The assistant must respect who is allowed to see what. It isn’t enough for it to hide the link to a confidential document. The content of that document must never reach the model at all, or it can surface in an answer.

That is why permission filtering has to happen at the search stage, before the model receives any passages. Access rights are covered in more detail in the article company data and AI tools.

Out-of-date content

An old price list left in the index is worse than none. You need a clear routine: when a document changes, the index is updated too, old versions are archived out of the assistant’s reach, and every citation shows the document’s date.

Questions search can’t answer

“How many of our contracts expire this year?” To answer that, you have to go through every contract, not find a few similar passages. An assistant built on retrieval only ever sees a selection of text, so with questions like this it may give an incomplete answer that still sounds convincing. Totals and counts belong in a database or a report.

In-house abbreviations and jargon

People ask “how do we handle an RMA?”, but the policy talks about the “returns procedure”. A glossary of internal terms and abbreviations added to the documents helps.

Instructions hidden in documents

The assistant also reads text that nobody in your company wrote, such as attachments from suppliers. If someone hides an instruction for the model in one of them, they can influence the answer. The OWASP security project lists a poisoned document in the assistant’s repository among its typical attack scenarios. That is one more reason a document assistant should only answer, not take actions. How tools that act on their own differ is covered in the article AI agents for business.

How to test it: a set of real questions

A vendor’s demo always looks good, because the vendor chose the questions. What matters is how the assistant handles yours.

  1. Collect real questions. From emails, the company chat, new colleagues and customer support. A few dozen is enough to start.
  2. For each question, write down the correct answer and the document that contains it. This has to be done by someone who knows the subject, not by the vendor.
  3. Add some tricky questions:
    • questions the documents don’t answer (the right response is “I don’t know”),
    • questions whose answer changed recently (the right response is the new version),
    • questions about content the person asking isn’t allowed to see (test with different accounts),
    • vague or casually worded questions.
  4. Grade every answer. Is it correct? Does it cite the right source? Does it admit uncertainty? Three grades are enough: right, partly right, wrong.
  5. Rerun the same set after every change. New documents, different settings or a different model can make results better or worse. Keep adding the questions the assistant got wrong in real use.

The result is a score you can track over time, plus a list of weak spots and where to fix them.

After launch

Testing doesn’t end at launch. Keep an eye on the questions the assistant answered with “I don’t know”: they often reveal a missing document. Give users a simple way to flag a bad answer, and go through those cases regularly. They are the quickest way to find where documents are incomplete or out of date.

Before you start

  • Pick one area of documents, not the whole company drive. Choosing a first pilot in general is covered in the article where AI really saves a small business time.
  • Clear out duplicates and old versions.
  • Check that permissions match reality.
  • Decide who will keep the content up to date.
  • Prepare your question set before you see the first demo.
  • Require citations, and an “I don’t know” when there is no source.
  • Let the assistant answer, not act.

If you’re curious how an assistant like this would work with your documents, get in touch. The service is described on the AI automation page, and the process on the working together page.

Read next

All articles

AI agents for business: what they are, how they differ from automation and where they fit

What an AI agent is, how it differs from a chatbot and from rule-based automation, where it fits in a business, its risks and how to start safely.

Automated invoice processing: how invoice data capture works and where it snags

What automated invoice processing is, how data capture works step by step, where it makes mistakes, how to set up checks and when it pays off.

Contact

Tell me what you need solved.

Calling is quickest. You can prepare a few sentences about your project here and send them as a text.You can prepare a few sentences about your project here, copy them and have them at hand when you call. No finished brief needed.

Contact form

Your message

No commitment. The website sends nothing. Your messages app opens with the text for me; you send it.The text is copied; then call me or text it to the same number.

I use your details only to reply and to discuss working together. How I handle your data

Jiří BejčekI read every message myself.

Get in touch