Kaishift · Casablanca
RAG pipeline development: make your documents answerable
A RAG pipeline retrieves the passages in your own documents that answer a question, then has a language model write the answer from those passages and link back to them. RAG pipeline development is the work that makes this hold up on real files: scanned contracts, a half-finished wiki, six years of tickets, four folders that disagree with each other. Built properly, every answer carries a citation, nobody sees a document they were not already allowed to open, and the whole system runs on accounts you own.
What is a RAG pipeline?
Retrieval-augmented generation. Your documents are split into passages and indexed. When someone asks a question, the pipeline searches that index, hands the matching passages to a model as context, and the model answers from them instead of from memory.
The model is never trained on your data and does not need to be. Change a document today, and tomorrow's answer changes with it. Delete one, and it stops being quoted.
Why RAG rather than fine-tuning or a longer prompt?
| Approach | Good at | Where it breaks |
|---|---|---|
| RAG pipeline | Answering from documents that keep changing, with a source per claim | Needs retrieval built properly rather than bolted on |
| Fine-tuning | Teaching tone, format, and task behaviour | Facts go stale the day a document is edited |
| Pasting everything into the prompt | Small, stable document sets | Cost and accuracy fall as the pile grows, and there is no source trail |
Most companies asking for a chatbot on their documents want the first row. The other two get sold to them because they are quicker to demo.
What RAG pipeline development actually involves
Ingestion. Drive, SharePoint, your CRM, your ticketing system, a shared mailbox, a database. Scanned PDFs go through OCR. Tables are extracted as tables, because a price grid flattened into a paragraph answers nothing.
Chunking on structure. Passages are cut at clauses, sections, and headings rather than every 500 characters. A contract clause split down the middle answers half a question, confidently.
Hybrid retrieval. Keyword search and vector search together. Vectors alone miss part numbers, invoice references, and surnames. Keywords alone miss the question asked in different words. A reranker orders what both return before anything reaches the model.
Grounded generation. The model answers from the retrieved passages only. When they do not contain the answer, it says so.
Evaluation. We write a question set with your team, with the correct answers and the documents they come from, and run it on every change. Retrieval is scored separately from the answer. When an answer is wrong, retrieval usually missed the passage, and swapping models would not have fixed it.
Refresh. Documents change, so the index follows. Edits, new versions, and deletions all propagate, including the deletions.
How do the citations work?
Every claim in an answer points at the passage it came from, and the passage links to the document, page, or section. Your team can open it and check.
The refusal matters as much as the citation. "That is not in your documents" is a correct answer, and we build for it rather than around it. A pipeline that always produces something is a pipeline nobody checks twice.
Can a RAG pipeline respect who is allowed to see what?
Yes, and this is where most internal deployments quietly fail. If everything is indexed into one pool, the salary review, the disciplinary file, and the unsigned acquisition memo become searchable by whoever asks the right question.
Access control belongs at retrieval, not at the end. Each passage carries the access list of the document it came from, taken from the source system, and the search is filtered by the identity asking before results are ranked. Filtering after retrieval leaks through the answer text even when the document link is hidden. When permissions change in the source, the index is re-synced. The wider controls around an indexed corpus, including injection defence and audit logging, are on the security floor.
Where do your documents and embeddings live?
On accounts with your name on them. The vector index, the document store, and the application run in your cloud, in a region you choose. Model APIs are configured for zero retention. You can log in and read every line of it without asking us.
This is the same standard we hold everywhere else, and the reasoning is set out in why your automation should run on accounts you control. For a RAG pipeline it matters more than usual, because the embeddings of your documents are your documents, statistically speaking. Hosting them on a vendor's account is handing over the corpus.
If you sell into the EU, we host in an EU region and paper it properly with a DPA and standard contractual clauses. Where your team sits and where your data sits are two different questions, and we treat them that way. Morocco, where we build, has been the 55th state party to Convention 108 on data protection since 1 September 2019, which is the footing a European legal team usually checks first. How we handle data as a company is in our privacy policy, and the commercial side of an engagement is in our terms.
Documents in English, French, Arabic, and Spanish
A real corpus is rarely in one language. Contracts in French, WhatsApp threads in Darija, official correspondence in Arabic, product documentation in English, a supplier file in Spanish, often inside the same folder and sometimes the same file. Any company that works in more than one language ends up with some version of this.
That is a retrieval problem before it is a model problem: right-to-left text, Arabic that has been through OCR, and questions asked in one language about a document written in another. We build and test in all of them, because we work in all of them.
Who this is for, and who it is not for
A good fit if: the same document question reaches your team every week; support, legal, procurement, or operations staff read the same files to answer it; your team needs to check the answer against the source before acting on it; your corpus is large enough or scattered enough that search alone stopped working.
Not a good fit if: you have two hundred pages that one person can read, in which case a search box is cheaper; your answers live in one clean database, in which case query the database; or the documents contradict each other and nobody has decided which version wins. A RAG pipeline over contradictory documents returns the contradictions faster. Fix the source first, and we will say so on the call rather than after the invoice.
How the first weeks go
We pick one set of questions that actually gets asked, ingest a real corpus rather than a demo folder, and put something working in your hands. Two weeks to that first deliverable, and those two weeks are refundable. After that we widen the corpus, add the sources you left out, and stay to run it.
RAG sits on the AI agents floor, one of five we run. If you want the pipeline to act on what it finds rather than answer questions about it, that is AI agent development, and the two are usually built together. You can walk all five floors to see how they connect, read what an AI automation agency does day to day, or take the longer arguments on the blog.
Bring us the question your team keeps answering by hand. Thirty minutes on a call, and a scoped, priced roadmap in writing within 48 hours. It is yours whether you sign or not.
Common questions
What is a RAG pipeline?
Retrieval-augmented generation. Your documents are indexed as passages, and when someone asks a question the pipeline searches that index and hands the matching passages to a model, which answers from them and cites them. The model is not trained on your files, so a document edited today changes the answer given tomorrow.
How do you stop it inventing answers?
Three ways. The model answers only from passages the pipeline retrieved. Every claim links back to the document, page, or section it came from, so your team can check it in one click. And when the retrieved passages do not contain the answer, it says so instead of guessing. All of it is tested against a question set your team writes.
Can a RAG pipeline respect who is allowed to read which document?
Yes, provided permissions are applied at retrieval rather than afterwards. Each indexed passage carries the access list of the document it came from, and the search is filtered by the identity asking before results are ranked. Filtering after retrieval leaks through the answer text even when the source link is hidden. When permissions change at the source, the index is re-synced.
Where do our documents and embeddings live?
In your cloud, on accounts you own, in a region you choose. The vector index, the document store, and the application run there, and model APIs are configured for zero retention. You can log in and read every line of it without asking us. If you sell into the EU, we host in an EU region with a DPA and standard contractual clauses.
How long until we can ask it a real question?
Two weeks to a first working deliverable, built on a real corpus rather than a demo folder, and those two weeks are refundable. We start with one set of questions your team already answers by hand, then widen the corpus once retrieval holds up on it.
Start with a call
Describe where the work hurts. You leave with a written roadmap of the first three moves, whether we work together or not.
Book a call