Request Case Studies

close icon
01
02

Message Sent

close icon
We’ve received your message and will get back to you shortly. In the meantime, feel free to explore our latest work.
Something went wrong. Please try again.

Data Ingestion for RAG: The Pipeline Behind a Reliable AI Assistant

How we built the data ingestion pipeline behind a RAG assistant for an insurance group: a governed knowledge base, grounding and citations on regulated content.

June 23, 2026
Stack of frosted glass slabs with a beam of peach light coming out of it, on a purple background

An Italian insurance group distributes its products through a network of more than 3,500 frontline staff. The knowledge needed to sell a policy and assist a customer, meaning contract terms, KIDs, internal circulars, regulatory updates and claims procedures, sat scattered across file shares and document archives, often in versions that didn't match. Finding the right information took between five and seven minutes, with a real risk of giving inconsistent answers on regulated matters.

For this client we designed and shipped to production a RAG system with a conversational assistant that answers by always citing the authoritative, currently valid source. The time to find the correct information dropped from minutes to under twenty seconds, with a hallucination rate on regulated content below 0.5%. The part that took the real work was the data ingestion pipeline that makes a heterogeneous document corpus genuinely queryable by an AI. That is what this article is about.

When people talk about RAG, the attention almost always lands on the model: which LLM, how much context, which prompt. In our experience the model is the least complicated part. What separates a proof of concept from a system the compliance function will let into production is the quality with which data enters the knowledge base: governed, versioned, citable. In a regulated industry, that quality essentially decides whether the system ever sees production.

In RAG, the model is the part that matters least

An LLM is only as accurate as the data it receives. "Garbage in, garbage out" holds for any AI system, but in RAG the effect is amplified: one wrong chunk, one expired document, one misread table, and the model produces a fluent, wrong answer in a confident tone. In the project mentioned above, the corpus arrived in heterogeneous formats (native and scanned PDFs, Word, Excel sheets for rate tables, HTML pages) and the versions were not always consistent. Without metadata, taxonomies and structured tables, those documents were effectively opaque to an AI: any system could only have guessed.

Why we call it knowledge injection

Most projects stop at the word "ingestion": taking data and bringing it in. On regulated corpora we raise the bar and talk about knowledge injection, because a document has to enter the knowledge base already governed: with a version, a validity window, an authoritative-source flag and, for regulated content, a human approval workflow. An expired document left in the index sooner or later becomes a wrong answer given with confidence. This governance is built in at the very moment the data enters the knowledge base, starting from acquisition.

The staged pipeline

We designed ingestion as a staged pipeline, incremental and cost-optimized. Here is what happens to a document, from its source to the point where it can be queried.

  • Acquisition and connectors. Dedicated connectors to the client's sources (document management, file shares, intranet, mailboxes for circulars, regulatory feeds), orchestrated with Prefect, with incremental sync and change detection so that only what changes gets acquired.
  • Parsing and layout understanding. Multi-format extraction with layout-aware OCR on scanned documents and structured table recognition, so no information is lost inside KIDs, policy terms and rate tables. This is where Azure AI Document Intelligence, PyMuPDF and the Unstructured library do their work.
  • Normalization and enrichment. Conversion into a canonical document model and language detection; then LLM-assisted metadata extraction (product, line of business, document type, regulatory references, validity dates) mapped to the client's product taxonomy, personal data masking with Microsoft Presidio, and entity linking.
  • Structural chunking. Splitting that respects sections and tables, with a parent-child hierarchy that keeps the context around each passage instead of cutting it at a fixed length.
  • Embedding and indexing. Multilingual vector representations with text-embedding-3-large, indexed in a hybrid index on Azure AI Search that combines lexical (BM25) and semantic search, enriched with metadata filters.
  • Governance. Knowledge base versioning, validity windows that exclude or deprioritize expired documents, full lineage and authoritative-source flags.
  • Continuous injection. Scheduled and event-driven updates: when a document changes, the system regenerates only the parts that actually changed, with selective diff-based re-embedding.

It is this last stage, continuous, selective injection, that keeps the assistant aligned with current documentation without re-indexing the entire corpus every time.

Diagram of the seven-stage data ingestion pipeline, from heterogeneous sources to the governed knowledge base
Diagram of the data ingestion pipeline for RAG: from heterogeneous document sources to parsing with layout-aware OCR, normalization, metadata enrichment, structural chunking, embedding and hybrid indexing, through to the governed knowledge base with continuous injection.
Diagram of the seven-stage data ingestion pipeline, from heterogeneous sources to the governed knowledge base
Diagram of the data ingestion pipeline for RAG: from heterogeneous document sources to parsing with layout-aware OCR, normalization, metadata enrichment, structural chunking, embedding and hybrid indexing, through to the governed knowledge base with continuous injection.

The detail that cuts costs

Reprocessing the whole corpus on every change is the simplest choice, and also the most expensive: it recomputes the embeddings for everything, every time. We tied re-embedding to the actual diff, so when a circular changes one section, only that section is recomputed. In production this cut re-indexing costs by 73% and brought the time to align the assistant with a regulatory update down from two to three weeks to under four hours.

On top of the knowledge base: retrieval and agents

Once the data is injected properly, the retrieval and generation layer can be designed for precision and safety. Retrieval combines metadata pre-filtering (line of business, validity, user permissions), hybrid lexical and semantic search, and a reranking step that brings the truly relevant passages to the top. Generation runs on a multi-agent orchestration built with LangGraph and LlamaIndex (after evaluating CrewAI), in which each agent has a single job: a Router classifies the intent of the question; a Retrieval agent fetches and ranks the passages; a Compliance and Citation agent checks that every statement rests on an authoritative, valid source, enforces citation and blocks the answer if the evidence isn't enough; a Synthesis agent writes the answer; a Calculation agent reads the structured rate tables to give consistent numerical examples. Over all of it, NeMo Guardrails enforces the grounding and refusal policies.

The guiding principle is clear-cut: no source, no answer. Without adequate documentation, the assistant doesn't improvise: it says it doesn't have enough information and points to escalation. And all of this runs with p95 latency under 2.8 seconds in production.

Diagram of the multi-agent RAG layer: retrieval, agent orchestration, compliance gate and cited answer
Diagram of the multi-agent RAG layer: from the staff member's question to retrieval (metadata pre-filter, hybrid BM25 and vector search, reranking), to the multi-agent orchestration with Router, Retrieval, Compliance and Citation, Synthesis and Calculation, through to the cited answer, with the "no source, no answer" compliance gate.
Diagram of the multi-agent RAG layer: retrieval, agent orchestration, compliance gate and cited answer
Diagram of the multi-agent RAG layer: from the staff member's question to retrieval (metadata pre-filter, hybrid BM25 and vector search, reranking), to the multi-agent orchestration with Router, Retrieval, Compliance and Citation, Synthesis and Calculation, through to the cited answer, with the "no source, no answer" compliance gate.

How we measured quality

In a system like this, quality has to be measured at every release. Together with the client's domain experts we built a golden set of about 1,200 question-answer pairs, representative by line of business and by intent type. On that set, and then on production telemetry, we track objective metrics with Ragas and LangSmith: faithfulness (how well the answer is supported by the retrieved sources), citation accuracy, retrieval precision and recall, and the hallucination rate. The steady-state numbers: 96.4% faithfulness, 98.1% citation accuracy, retrieval at 0.91 precision and 0.88 recall, hallucination on regulated content below 0.5%. Every significant change to the pipeline or to the agents goes through this golden set before release.

Production results: search under 20 seconds, re-indexing cost −73%, hallucinations below 0.5%, faithfulness 96.4%, citation accuracy 98.1%, adoption at 78%
The system's production results: information search under 20 seconds versus 5-7 minutes, re-indexing cost down 73%, hallucination on regulated content below 0.5%, faithfulness 96.4%, citation accuracy 98.1%, network adoption at 78% after three months.
Production results: search under 20 seconds, re-indexing cost −73%, hallucinations below 0.5%, faithfulness 96.4%, citation accuracy 98.1%, adoption at 78%
The system's production results: information search under 20 seconds versus 5-7 minutes, re-indexing cost down 73%, hallucination on regulated content below 0.5%, faithfulness 96.4%, citation accuracy 98.1%, network adoption at 78% after three months.

Conclusion

This client has the distribution, the brand and the domain expertise. What it lacked was a data and AI engineering team able to take a system like this to production, with the governance a regulated industry demands. We worked as an end-to-end external tech team, from product strategy to MLOps, behind the scenes. A pilot on two lines of business in ten weeks, and the full system on those lines in nine months.

The operational change is qualitative: the network went from searching to asking, with the guarantee that every answer rests on a current, citable document. Adoption reached 78% of frontline staff in three months, and second-level escalations fell by 42%. For a compliance function, full traceability of every answer is as much a result as speed.

If you have a document corpus that an AI should be able to query, choosing the model is the easy part. The serious question is about your data: is it versioned and up to date, with a source you can always trace? Almost no archive already is, and that is where the game is won or lost.

FAQ

What is the difference between data ingestion and data injection?

Data ingestion is the standard term for the process that acquires data from different sources and prepares it for use. We use "knowledge injection" in regulated contexts to raise the bar: the data has to enter the knowledge base already governed, with a version, a validity window and a tracked authoritative source. It is the same family of processes, with stricter governance requirements.

Why does data ingestion matter more than the model in a RAG system?

Because an LLM is only as accurate as the data it retrieves. The model is by now an interchangeable commodity, while retrieval quality depends on how the documents were extracted, normalized, enriched with metadata and segmented. A wrong chunk or an expired document produces a fluent, unreliable answer. In a regulated industry, where every statement has to be cited and grounded, the ingestion pipeline is where the system becomes reliable, or doesn't.

How do you stop an AI assistant from making up answers on regulated content?

The main lever is grounding: every statement has to rest on a passage retrieved from an authoritative, currently valid source, with mandatory citation checked by a dedicated agent that blocks the answer when the evidence is insufficient. On top of that comes below-threshold abstention: without adequate documentation, the assistant says it doesn't have enough information and points to escalation, instead of improvising.

How much does it cost to keep a RAG knowledge base up to date?

The cost depends almost entirely on how you handle updates. Reprocessing the whole corpus on every change is simple to implement but expensive, because it recomputes the embeddings for everything, every time. The alternative is to tie re-embedding to the actual differences, so that only the parts of a document that change are recomputed.

How long does it take to bring a RAG system to production in a regulated industry?

It depends on the quality of the starting sources and on the governance requirements, but a realistic path starts with a pilot on a narrow scope, to validate the approach before scaling. In the case described in this article, we put a pilot on two lines of business into production in ten weeks and completed the system in nine months.

Have a document corpus but no team to build the pipeline?

Start now with Mokka Studios and turn your ideas into measurable results through innovative software development practices.