Skip to content
Upstone

AI assistants

An AI assistant that answers from your documents and cites its sources (RAG): how it works

How an assistant can answer from your own documents, show the exact source of each answer and refuse when it finds nothing, explained step by step for firms, quality teams and clinics.

The Upstone team · Updated · 5 min read

In short: the assistant does not know your documents by heart. When someone asks a question, it first searches your document base for the most relevant passages, then writes an answer using only those passages, with a reference for each one. If nothing relevant turns up, it says so. This approach is called RAG (retrieval-augmented generation). It suits law firms, accounting firms, quality departments and clinics: places where the right answer is written down somewhere but hard to find, and where an answer without a source is worthless.

Why a general chatbot is not enough

A general AI model writes fluent text, but it has never read your internal procedures, your client files or the latest version of a regulation. Worse, it can produce a reference that looks real and is not. For a lawyer, an accountant or a quality manager, that is unacceptable. What you need is an assistant that behaves like a careful junior colleague: it looks up the documents, quotes them, and admits when it cannot find the answer.

How it works, step by step

1. Indexing your documents

We connect the sources you choose: a shared drive, a document management system, PDFs of regulations, procedure manuals, past memos or opinions. Scanned pages go through OCR so the text can be read. Each document keeps its metadata: title, date, version, department, and who is allowed to see it.

2. Splitting into passages

Documents are cut into passages of a few paragraphs, ideally following their natural structure: articles of a law, sections of a procedure, clauses of a contract. Good splitting matters more than people expect. A passage cut in the middle of an exception (“except when…”) leads to a wrong answer.

3. Semantic search with embeddings

Each passage is converted into an embedding: a list of numbers that represents its meaning. The question is converted the same way, and the system finds the passages whose meaning is closest, even when the words differ. “Can I let someone go during their trial period?” will find a passage on “termination during probation”. In practice we combine this with classic keyword search, which remains better for article numbers, file references and proper names.

4. Generating an answer with citations

The best passages, often five to fifteen, are sent to the language model with strict instructions: answer only from these extracts, cite the source of each statement, quote the exact wording when it matters. The user sees the answer and clickable references: document, section, page.

5. Refusing when the source is missing

This is the most important rule. If no passage is relevant enough, the assistant replies “I did not find this in the documents available to me” and, where useful, suggests who to ask. A refusal is a correct answer. An invented one is a fault.

Keeping the base current and respecting permissions

A document base changes all the time: new procedures, amended rules, updated templates. Four mechanisms keep the assistant reliable:

  • Scheduled updates: new or modified documents are re-indexed automatically, often every night. Old versions are removed or marked as superseded so they are no longer cited.
  • Dates in answers: the assistant shows the date or version of each source, so users can spot an outdated text at a glance.
  • Permissions: the search only covers documents the user is allowed to see. A trainee does not get passages from a partner’s confidential files; a nurse does not see management documents.
  • Logs: each question, the sources used and the answer are recorded, which helps for audits and for improving the tool.

Examples by sector

What a source-citing assistant looks like in different teams
SectorTypical documentsExample question
Law firmCodes, case law, internal memos, contract templatesWhich non-compete clause did we use in past service agreements?
Accounting firmTax guidance, internal procedures, engagement lettersWhat is our checklist for closing a small company’s year-end accounts?
Quality departmentProcedures, work instructions, audit reportsWhat do we do when a batch fails inspection?
ClinicCare protocols, internal rules, patient information sheetsWhat is the pre-operative protocol for this procedure?

Our pages for law and accounting firms and for clinics and healthcare cover the constraints specific to each: professional secrecy, health data, retention periods.

What it costs to run

There are two parts: building it and using it. Setting up an assistant on your documents is on quote: the price depends on the number of sources, the document formats and the permission rules, and you receive a free, fixed written quote within 24 hours. Usage costs come from the AI model and hosting, and stay modest in general:

  • Indexing is mostly a one-off cost: usually a few euros to a few tens of euros for several thousand pages.
  • Each question costs, in general, between a fraction of a cent and a few cents, depending on the model and the number of passages sent.
  • For a team of 10 to 30 people asking questions daily, monthly usage often lands between a few dozen and a couple of hundred euros, plus hosting.

Measuring quality before trusting it

Never judge an assistant on a demo. Before going live, we build a test set with you:

  1. 50 to 100 real questions, written by the people who will use the tool, each with the expected answer and the expected source.
  2. Questions with no answer in the base, to check that the assistant refuses rather than invents.
  3. Scoring: was the right source found? Is the answer faithful to it? Does the citation point to the right place?
  4. Re-running the test after every change (new documents, another model, a different splitting rule) to make sure nothing got worse.

Limits to keep in mind

  • No automatic legal, tax or medical advice. The assistant finds and summarizes texts; a professional rereads and decides. Anything sent to a client or patient is validated first.
  • It is only as good as your documents. Contradictory or outdated procedures give contradictory answers. The project often reveals documents that need cleaning up, which is useful in itself.
  • Tables, handwriting and poor scans are harder to read and may need specific processing.
  • Very broad requests such as “summarize all our files” are not its strength. Precise questions work far better.

Getting started

Start with one well-defined base (your procedure manual, a body of regulations, your contract templates) and one group of users. Build the test set, measure, then widen the scope. We have delivered this kind of assistant, including a legal assistant that answers from a large base of texts and cites each source. For other ways to use AI, see 7 practical uses of AI in a small business. To see how it would work on your own documents, tell us about them: you will get a fixed quote within 24 hours.

Have a project like this?

Describe it in a few lines and get a fixed quote within one business day.

Request a quote

Frequently asked questions

What is RAG, in simple terms?

RAG means the assistant first searches your documents for relevant passages, then writes its answer from those passages only. That is how you get answers with sources you can check, instead of text drawn from the model’s general knowledge.

Can the assistant still make things up?

The risk is much lower but not zero. That is why every answer cites its sources, the assistant is set to refuse when nothing relevant is found, and quality is measured on a test set before going live.

Are our documents used to train the AI?

No. We use AI providers under business terms that exclude training on your data. Your documents stay in a base you control, with access restricted by role.

Can it replace a lawyer’s or an accountant’s review?

No. It saves time finding and summarizing the right texts, but any advice given to a client must be reread and validated by a professional.