Skip to content

RAG implementation

We build RAG using your own documents: properly chunked, with document-level access permissions and a source for every answer. For Fokker, we built Anthony Chat.

Anthony Chat uses a RAG model to extract relevant information from internal documents for Fokker Services Group

“Working with Data Science Lab on projects ranging from market intelligence to AI-driven chat solutions has been invaluable for deriving smarter business solutions. […]” Kaveh Alizadeh, Manager Program Management, Fokker Services Group

Read the case study

Why does our RAG demo work well but miss the questions our colleagues actually ask?

A demo with ten PDFs works quickly. With thousands of documents, old versions, tables and department-level permissions, things go wrong at the retrieval stage, not in the language model. That’s where the specialist work lies.

Book a conversation

A RAG system that retrieves the right passage and shows you where to find it

Discuss your RAG question

Questions about internal documents

For Fokker Services Group, we built Anthony Chat: employees ask questions about internal documents and get answers through a RAG model.

Chunking with metadata

We split documents at headings, articles and tables, and attach metadata such as version, department or client to each chunk so results can be filtered.

Hybrid search and reranking

Vector search finds passages with similar meaning, while keyword search finds codes and names. A reranker then puts the best passages first.

Access rights and source references

You only get answers from documents you are allowed to open at the source, with the document and paragraph identified so you can check them.

Start with a test set of real questions, then choose the embeddings and index

  1. Test set and sources

    We work with users to collect real questions, the correct answers and the passages where those answers can be found.

  2. Measure retrieval, then assess answers

    First, we measure whether the right passage appears at the top. Then we check whether the answer matches that source.

  3. Keep it up to date

    New and updated documents are automatically added to the index again, and the test set runs with every change.

Is RAG the right approach for the questions we have?

Talk it through with us

A good fit when

The answers are in text: procedures, manuals, contracts or policies. Colleagues search these documents often and want to know where something is stated, not just what it says.

Not a good fit when

The question is about figures from a database or ERP system, such as revenue by region. In that case, you need a model that runs a query on your data, not a text search tool.

What determines the scope

The number of sources and formats, scans and tables, how granular access rights are, how often documents change and how rigorous the evaluation needs to be.

Will only the person who built it understand how it works?

We build with standard components and document our choices about chunking, embeddings and the index. If you replace the language model later, you rerun the test set.

Off-the-shelf assistant, your cloud provider's RAG service or bespoke RAG?

An off-the-shelf assistant

Choose this if your documents are mainly in SharePoint and Teams and the permissions are set correctly there. An off-the-shelf assistant is then quicker to set up.

Your cloud provider's RAG service

Choose this if you already use a cloud platform and want a managed search index. You'll build with the provider's components, within their limits.

Bespoke RAG

Choose this if your sources, permissions or document types differ from the norm, or if you want to measure results and make adjustments yourself. Our advice: start with one document type and a test set.

We write about internal LLMs and RAG based on our own project work

Data Science Lab has been operating since 2016 and is a Microsoft Partner and Databricks Partner. What we learned while working on Anthony Chat, such as breaking down multi-part questions and filtering by metadata, is covered in our blog about internal LLMs.

Book an introductory meeting

Your documents and the questions you need them to answer are the starting point for our conversation

Stef Stoelwinder

Stef Stoelwinder

Business Development

Stef is your point of contact. In our first conversation, we’ll discuss your sources, access permissions and what your colleagues currently look up manually.

Which documents should the answer be found in?

Tell us what the sources are and who asks the questions. We’ll reply by email or arrange an initial conversation.

Enter a valid email address.

Let us know how we can help you.

Frequently asked questions

RAG combines search with a language model. When you ask a question, the system first retrieves relevant passages from your own documents and passes them to the model, which uses them to produce an answer with a reference to the source.

RAG is one of the building blocks of generative AI that we put into production.

Ideally, you follow the document’s structure—chapters, articles and tables—rather than splitting it after a fixed number of characters. Chunks that are too small lack context; chunks that are too large dilute the search score.

Each chunk includes metadata, such as the document, version and department. We use the test set to measure which size works best.

An embeddings model converts text into a series of numbers so that texts with similar meanings are close together. These vectors are stored in a vector index. A question is converted in the same way, and the closest chunks are retrieved.

For more background, read our blog on internal LLMs and RAG.

Vector search finds passages with similar meanings, but it sometimes misses exact terms such as product codes, article numbers and names. Keyword search finds those terms. Hybrid search uses both approaches and combines the results.

A reranker then assesses the best candidates against the question again, so the language model receives the most relevant passages.

Permissions from the source, such as SharePoint groups or folder permissions, are included in the index as metadata. For every question, the search step filters results according to the user’s groups before the language model sees anything.

If permissions change at the source, the index is updated.

We use a test set of real questions, the correct answers and the passages containing them. We measure separately whether the right passage is retrieved and whether the answer remains faithful to it.

We run the test set again after every change to the chunking, embeddings model, language model or prompt.

Only to a limited extent. RAG searches text. For monthly revenue or stock by location, you need a model that runs a query on your data, and you often combine the two approaches.

You can read about both approaches in Connecting AI to your own data.

If you have a fixed set of questions with short answers, a chatbot with a managed knowledge base is often enough. And if your documents are well organised in Microsoft 365, a standard assistant may be sufficient.

You can read about the chatbot itself in Getting an AI chatbot built.