2 min read
RAG in a closed environment: a company assistant that keeps data at home
What RAG is, why it answers from your documents instead of the internet, and how to deploy it so that sensitive data never leaves your environment.
- RAG
- AI assistant
- data security
In most companies, the most valuable knowledge is scattered across contracts, policies, manuals and emails. Anyone looking for the notice period in a supplier contract or the purchase approval procedure often spends more time searching than doing the actual work. Language models promise help — but without access to company documents they can't answer, and with access, the question arises of where those documents end up.
This is where RAG in a closed environment comes in.
What RAG is
RAG stands for Retrieval-Augmented Generation. The model doesn't answer from what it “remembers” from training; instead, it works in two steps:
- Retrieval. For each question, it first finds passages in the database of your documents that are related in meaning — not just by exact words.
- Answer. Only then does it compose an answer from the passages found and attach links to the sources.
Put simply: along with the question, the model gets a “cheat sheet” from your own materials.
Why citations matter
Language models can sound convincing even when they are wrong. For a company assistant, a good answer is therefore not enough — it must be verifiable. Every statement links to a specific document and passage, so a person can check it with one click. And when the answer isn't in the documents, the assistant should say it didn't find it instead of making it up.
What a “closed environment” means
The biggest risk of the whole solution is simple: the promise of a closed environment doesn't hold if data leaves via an API somewhere outside your control. That's why we build RAG so that:
- documents and the search index are in a PostgreSQL database with the pgvector extension right in your environment,
- sensitive data is processed only by language models in the EU or by a local AI server right on your premises, depending on the configuration you need,
- the rules on which data may go to which model are agreed in advance and written into the contract.
What a deployment looks like
A typical project has four parts:
- Source analysis — where the documents are, who may access them and how often they change.
- Retrieval layer — the standard is a lightweight retrieval layer on PostgreSQL and pgvector, which we deploy in your environment.
- Model connection — via an MCP server, the assistant connects to Mistral or Claude models. When prices or terms change, we swap the model, not the whole solution.
- Interface and operations — a simple interface for employees, updates and monitoring.
When RAG isn't enough
For large enterprises with mature data and the budget, a custom model trained directly on their data can make sense — for example, via the Mistral Forge platform. For small and medium-sized companies, however, this is usually oversized and expensive. In most cases, a good retrieval layer and off-the-shelf models are enough.
How to get started
Ideally with a small pilot: one team, one set of documents and a clearly measurable goal — for example, how much time the sales department saves when searching contracts. We deploy RAG in a closed environment as a pilot for one team at a clear price up front. If you want to know what it would mean for you, write to us.