Confidential clients · Under NDA

RAG · On-premises and hybrid · Several builds

Private retrieval systems for regulated and multilingual clients

How I design retrieval around the three questions every client asks first: where the data goes, who can see each answer, and what it costs to run.

Project facts

My role
Architect and builder
Users
Client staff with different roles, and customers for the support build
Builds
On-premises, permission-gated, multilingual, customer support
Stack
LlamaIndex, LangChain, PGVector, PostgreSQL, Ollama (nomic-embed-text, llama3.1), OpenAI API

What this page shares

  • The sector, scale and the type of users involved
  • My role, the stack and why it was chosen
  • A conceptual architecture drawn by me
  • The decisions I made and the alternatives I rejected
  • Results as ranges, directions or mechanisms

What stays private

  • The client's name, brand and country list
  • Screens, UI, internal system names and URLs
  • Any personal data about users, customers or patients
  • Internal documents, exact volumes and revenue figures
  • Source code, schemas and configuration

Context and problem

Clients want an assistant that answers from their own documents, and each one brings a different hard limit. Some cannot send a single document to a hosted model. Some need answers to respect existing permissions. Some work in more than one language.

This write-up covers four builds that share one pattern, each tuned to its limit.

Constraints

Data residency
For some clients, documents and questions must never leave their infrastructure.
Existing permissions
A user must never get an answer drawn from a document they cannot open.
Language and cost
Retrieval has to work across languages, at a running cost the client accepts.

Architecture, conceptual

Drawn by me from the design. Component names are generic on purpose. This is not the client's documentation.

Key decisions and what I rejected

Key decisions and what I rejected
DecisionAlternative rejectedWhy
Local embeddings and generation with OllamaA hosted model APIThe client could not send documents to an outside provider, so everything runs on their infrastructure.
Filter by role and identity in the vector queryTelling the model to withhold restricted contentA prompt can be talked around. Filtered retrieval never hands restricted text to the model.
A hosted model for the multilingual buildA local model, as in the private buildsFor that client, retrieval quality across languages mattered more than residency.
Local embeddings with hosted generation where it paid offAll hosted or all localEmbedding is the high-volume step. Keeping it local lowers cost, while answers still come from the stronger hosted model.

Results

Exact figures are confidential under the client agreement, so the results below are directions and mechanisms rather than numbers.

  • No documents sent out

    on the private builds

    Embedding and generation run on the client's own infrastructure.

  • Access checked

    before the model sees any text

    Permissions apply at the vector layer, so restricted content never enters a prompt.

  • Follow-ups

    answered in context

    Chat history in PostgreSQL lets users ask the next question naturally.

What I would do differently

I would build a set of real client questions at the start, with the answers they expect. It is the fastest way to compare chunking and model choices with evidence instead of judgement.

Not published on this page

  • Client names, sectors and document sets
  • Prompts and permission rules
  • Usage volumes and running costs
  • Source code and configuration

Written from my own knowledge of the design. No client documents, screens or data were used.

Walk through this project on a call

30 minutes. I explain how permission filtering and local inference fit together, and how I choose between local and hosted models for a given client. The call covers my engineering reasoning, not client details.