← All posts
SanadAI assistantsField notes

Nobody can find what’s in your contracts. Here’s how an AI assistant over your own documents should work.

Your team answers the same questions all day, and the answers are buried in contracts, manuals and invoices. Why plain ChatGPT isn’t enough, and how I built an assistant that cites the exact sentence or says it doesn’t know.

Reda BellasseryReda Bellassery· ·7 min read
localhost:8080/ask
Sanad citation drawer: the contract page opens with the quoted sentence highlighted

Key takeaways

  • An AI assistant over your documents answers questions from your own contracts, manuals and invoices, not from the internet, and shows where each answer came from.
  • Plain ChatGPT isn’t enough for company documents: it can’t see your files, it doesn’t point to the page, and it will invent a convincing clause rather than admit it doesn’t know.
  • A good assistant checks every quote against the real text before you see it, says “I can’t find this” when the files don’t support an answer, and hands the question to a person when it isn’t sure.
  • Privacy is a design decision: each company’s data isolated in the database, IBANs, emails, phone numbers and tax codes masked before any external model call, and an EU-hosted model as an option.
  • Before you build one, check four things: your documents are digital, someone owns the answers, you know the questions people ask, and you’ll test it on real questions before launch.

Someone in your office answers the same question three times before lunch. “How much notice do we need to cancel the cleaning contract?” “What are the payment terms with that supplier?” “Where’s the procedure for returns?”

The answers exist. They’re in a contract, a manual or an invoice, somewhere in a shared folder. Finding them means opening files one by one, so people ask the one colleague who remembers.

And sometimes nobody remembers. An auto-renewal clause with 60 days’ notice slips by, and the company pays for another year of a service it wanted to drop.

This post is for owners and managers of small and mid-sized companies with a lot of documents and no legal team. I’ll explain what an AI assistant over your own documents is, how it should behave, and what it costs to get one right.

What is an AI assistant over your own documents?

An AI assistant over your documents is a chat that answers questions using only your company’s own files, and shows you the page each answer came from. You ask in plain words. It finds the right passage in your contracts, manuals or invoices and answers from that passage.

The technique behind it is called RAG, retrieval-augmented generation. In one plain sentence: the system first searches your files for the passages that match the question, then asks the AI model to answer using only those passages.

That’s the whole idea. The model brings the language. Your documents bring the facts.

Why isn’t plain ChatGPT enough?

Because it doesn’t know your company, and it won’t tell you when it’s guessing. I use ChatGPT and Claude every day, and they’re excellent. For company documents they hit three walls:

  1. No access. It can’t see your files unless someone pastes them in. Most companies don’t want contracts and invoices pasted into a public chatbot, and they’re right.
  2. No citations. Even when it has the text, it gives you an answer without the page and sentence it came from. On a contract, an answer you can’t check is worth very little.
  3. Invented answers. Language models produce convincing quotes. Ask about a clause that doesn’t exist, and you may get one that sounds exactly like your contract.
In a product about contracts, one fake clause destroys trust.

Why can’t anyone find what’s in the documents?

Because business documents are written to be signed, not searched. The answer to “how much notice do we need” is usually one sentence on page one of a PDF, in legal wording nobody types into a search box.

Normal search has two blind spots. Keyword search misses the answer when the words differ: you type “cancel”, the contract says “notice of non-renewal”. AI search, which matches by meaning, has the opposite problem. It handles invoice numbers, IBANs, supplier names and clause numbers badly.

So in Sanad I run both in one database query and merge the results. That’s called hybrid search. On my test set, hybrid search put the right passage in the top three results for every answerable question.

How should a good document assistant behave?

It should be useful when it knows, honest when it doesn’t, and quick to call a person. Three rules I build every assistant around:

01Every quote is checked.

The model cites numbered sources. Before the answer reaches the screen, each quote is matched back against the real text. A quote that doesn’t match is dropped, and the confidence shown to the user goes down.

02It says “I don’t know”.

If nothing in your files supports an answer, the assistant says so. A blank answer costs a minute. A wrong one about a notice deadline can cost a year of fees.

03It hands over to a person.

When the assistant isn’t sure, the question goes to someone who can answer it. On an assistant for staff or customers, that handover is part of the design, not an afterthought.

There’s one more rule people forget: the documents themselves can attack you. A malicious instruction can hide inside an uploaded file, not only in the user’s question. Sanad scans the question and every retrieved passage for prompt injection, meaning text that tries to give the AI new orders, before it goes into the prompt.

How I built it in Sanad

Sanad is an AI assistant I built for small and mid-sized companies. It reads a company’s contracts and invoices, cites the exact sentence, and never acts without approval. The demo company is a fictional shoe maker in Civitanova Marche, with contracts, invoices and policies in English, Italian and Arabic.

localhost:8080/ask
Answers with the source file and page, a confidence level, and a prompt injection blocked before any model call.
Answers with the source file and page, a confidence level, and a prompt injection blocked before any model call.

You upload the documents once: PDF, Word or plain text. A background worker reads each file, splits it into passages, detects whether it’s a contract, invoice or policy, and extracts the terms that matter. Then you can ask in English, Italian or Arabic, and every citation opens the page with the quoted sentence highlighted.

I didn’t want to call it good on a feeling. Sanad is measured on 44 test questions every time the code changes, and the build fails if the scores drop below the thresholds:

1.00right passage in the top 3 (hybrid search)
0.94citation accuracy
0.80“I don’t know” on unanswerable questions
100%injection attempts blocked

Read those honestly. The scores come from the offline test setup, on sample documents, not from a real company. Saying “I don’t know” at 0.80 is good, not perfect. Sanad has no paying customers yet. The next step is a pilot with a real SME and the same tests on real contracts.

The same assistant on a phone: ask a question, or check the contract register with its notice deadlines.
The same assistant on a phone: ask a question, or check the contract register with its notice deadlines.
The same assistant on a phone: ask a question, or check the contract register with its notice deadlines.

What about privacy?

Privacy isn’t a checkbox at the end. It’s how the system is built from the first table. In Sanad that means four things:

  • Each company is isolated by the database. Row-level security, the database checking who may read each row, is on for every company table. If the company isn’t set on a request, queries return nothing.
  • Sensitive values are masked. IBANs, emails, phone numbers and Italian tax codes are masked before any external model call, and restored in the answer.
  • You choose where the model runs. The same code works offline, with OpenAI, with an EU-hosted OpenAI-compatible endpoint, or with Claude, switched with one setting.
  • Everything is logged. Every model call is metered, and every human decision is written to an audit log with who decided and when.

The EU AI Act now applies too. For most internal document assistants the practical side is transparency and keeping a human in charge. I’m a developer, not a lawyer, so check your own case with yours.

What does it cost, and what can go wrong?

There are two kinds of cost: building it carefully once, and paying for model calls every day. The first is mostly checks and testing, not the chat window. The second you can measure. Here’s the honest list:

Cost or riskWhat it meansWhat I do about it
Building and testingMost of the work is checks, isolation and a test set, not the chat windowScope, timeline and price agreed in writing before work starts
Model usageEvery question, upload and extraction calls a modelCost metered per company and per operation, so the expensive part is visible
Scanned PDFsA photo of a page has no text to searchSanad doesn’t read scans yet; OCR is on its roadmap
Lost citationsA correct answer that paraphrases can lose its quoteLower confidence is shown, not hidden
Questions across languagesAn Italian question about an English contract is harderThe test report lists these misses openly
New attack phrasingsInjection detection based on patterns needs upkeepBlocked attempts are shown with the matched patterns, so gaps are visible
localhost:8080/usage
Calls, tokens and cost by operation, plus the audit log of human decisions. The demo runs offline, so the cost here is zero.
Calls, tokens and cost by operation, plus the audit log of human decisions. The demo runs offline, so the cost here is zero.

If cost is your main worry, I wrote a separate post on keeping AI features affordable.

Is your company ready? A checklist

You don’t need to be a tech company. You need a few basics in place. Go through this list today:

  1. Your documents are digital. Text PDFs, Word files or plain text. If most of them are paper scans, that’s step zero.
  2. You know the top questions. Write down the twenty questions people ask most. They become the test set.
  3. Someone owns the answers. A person who decides what’s correct and takes the questions the assistant can’t answer.
  4. You know who sees what. Which documents are for everyone, and which only for management or accounting.
  5. You’ve decided where data may go. Any provider, EU-hosted only, or nothing leaving your servers.
  6. You’ll test before launch. On your real questions, including ones the documents can’t answer.

If you can tick four of six, you’re ready for a first version. If not, the list tells you what to fix first.

What to do next

Start with the questions, not the technology. Pick one folder, for example supplier contracts, and the ten questions people ask about it most.

If you want to see how the pieces fit, the Sanad case study shows every screen, the test results and the trade-offs. My services page explains how I build AI assistants for companies. If the next step is letting AI do things, not just answer, read how I hand work to an AI team without losing control.

I’m based in Macerata and work with companies across Italy and Europe. Tell me about your documents and the questions your team keeps answering, and I’ll reply with questions or a plan for a first call.

About the screenshots: every image comes from Sanad running on its demo company, a fictional shoe maker in the Marche, captured by the project’s own end-to-end script.

Questions people ask

What is an AI assistant over company documents?

It is a chat that answers questions using only your company’s own files, such as contracts, manuals, policies and invoices. It first finds the passages that match the question, then writes an answer from those passages and shows the source. This approach is called RAG, retrieval-augmented generation.

Why can’t we just use ChatGPT for this?

ChatGPT doesn’t have access to your files unless someone pastes them in, which many companies don’t want to do with contracts and invoices. It also doesn’t point to the exact page, and when it doesn’t know, it can produce an answer that sounds right and isn’t.

How do you stop the assistant from inventing answers?

In Sanad every quote is matched back against the retrieved text before it reaches the screen. Quotes that don’t match are dropped and the confidence goes down, and if nothing supports an answer, the assistant says so instead of guessing.

Is our data safe with an AI document assistant?

It depends on how it is built. In Sanad each company’s data is isolated by the database itself, sensitive values like IBANs and tax codes are masked before any external model call, and the model can run on an EU-hosted endpoint. Ask any supplier to show you how they do each of these.

Can you build a document assistant for my company?

Yes. I build AI assistants that answer from your own documents, website or database, show the source of every answer and are tested before launch. I’m based in Macerata and work with companies across Italy and Europe. Write to contact@stackreda.com or use the contact page.
Reda Bellassery
Reda BellasseryFounder of VYNORO · Full-stack & AI developer in Macerata, Italy

I build AI agents, web apps and mobile apps for businesses, and I run my own agency, Barmjli. I write here about what I build and what it taught me.

Keep reading