RAG Chatbot Engine n8n · OpenAI · Pinecone · Gemini

Production-grade RAG chatbot engine

An end-to-end retrieval-augmented generation system built in n8n. It answers questions only from an indexed document set — the demo uses a recipe book, master-food-recipe.pdf — so replies come with exact ingredient amounts and step-by-step instructions instead of guesses.

The system runs as two pipelines: one that ingests and indexes knowledge, and one that answers questions in a multi-turn chat.

  • - Ingestion: a form trigger accepts a PDF, the Default Data Loader splits it into chunks, OpenAI text-embedding-3-small embeds them, and the vectors are stored in a Pinecone index.
  • - Query: a chat trigger passes the question to an AI agent that uses the Pinecone vector store as a tool to retrieve the most relevant chunks.
  • - Memory: n8n Simple Memory keeps context across turns.
  • - Answer: Google Gemini combines the question, retrieved chunks and chat history into a grounded reply.

Why it matters for a business: the same pattern turns policy documents, product catalogues or support FAQs into an assistant that only says what the documents say.

Pipeline at a glance

1 · Knowledge ingestion

  1. Form trigger (PDF upload)
  2. Default Data Loader & chunking
  3. OpenAI embeddings
  4. Pinecone index

2 · Conversational query

  1. Chat trigger
  2. AI agent + Pinecone tool
  3. Simple Memory
  4. Gemini answer
View repository