Back to the guides

Set up an internal RAG

A bounded set of docs, search with a source, and a chat or API the team can use.

An internal RAG is a bounded set of documents, a search that returns chunks with a source, and a chat or API in your environment. Usual stack: OpenAI, LangChain, a Python or FastAPI backend. Docker when it has to run outside a notebook.

Which documents go in

This is the decision that weighs most. You do not index “everything in Drive”. You pick what the team already uses to answer: procedures, policies, manuals, closed tickets of one kind. You leave out contracts outside the case, people’s data, secrets and drafts nobody has validated.

Formats: PDF, wiki, Markdown, Drive exports or an API. Before embedding, you clean: covers, footers, broken tables, duplicates. If you cannot cite it, it should not go in. If you do not know where it came from, it is noise.

Search you can defend

The model does not read the whole file. You split, embed, search, and only the recovered context goes in. The team has to see the source: title, fragment, link or path. Without that, the answer is a guess.

  • Split by real sections, not by a size that breaks meaning.
  • Metadata: origin, date, who may see it, language. They filter before you generate.
  • If nothing useful comes back, say so. Making things up is worse than staying quiet.

LangChain or a Python pipeline of your own is fine if the team can read it. pgvector, Pinecone or Chroma are chosen by where the system will live, not by fashion.

Chat or API

Internal chat: a channel the team already opens. API: the RAG is consumed from a product, an agent or n8n. Both work. Whoever asks comes in with a company account.

You need authentication, a log of questions and a way to reindex when the files change. FastAPI or Node will do. Angular or React only if you need your own UI.

How it is operated

Who deploys it. Where the keys live. How the index is updated. What happens when an answer is wrong. Docker is the minimum so it does not depend on a laptop. Kubernetes, Terraform, AWS or Azure come in if the team already works that way.

If you want me to set it up, that is on RAG and agents. The detail of what goes in and who may ask is in data and access for a private GPT. Madrid.

Contact

Email me

If you need an agent, a RAG or an n8n flow set up, email or call.