Implement a robust Retrieval-Augmented Generation (RAG) system using Qdrant vector database, Google Gemini, and OpenAI. This complete n8n workflow template enables automatic source citations from Google Drive documents.
Download this n8n workflow template and start using it instantly.
Data scientists and developers looking for robust, production-ready RAG n8n templates.
Businesses needing highly accurate, verifiable AI answers based on internal documents.
Users who want to integrate specialized tools like Qdrant into an automated n8n workflow.
Anyone requiring complex AI orchestration managed through a visual, low-code n8n node approach.
This comprehensive n8n workflow implements a state-of-the-art Retrieval-Augmented Generation (RAG) system designed to deliver accurate, contextually grounded answers while automatically citing sources. It addresses the challenge of LLM hallucination by ensuring answers are generated strictly based on provided documents stored in Google Drive.
The initial phase uses the Google Drive n8n node to fetch documents, which are then chunked and vectorized using the OpenAI embeddings n8n node. These vectors are securely stored in the Qdrant vector database. When a query is received via the chat n8n trigger, the workflow retrieves the most relevant knowledge, feeds it to the Google Gemini large language model, and uses custom logic within an n8n node to extract and deduplicate the source document names, making this a powerful and reliable n8n template for knowledge management.
This n8n workflow operates in two distinct phases: Ingestion/Indexing and Query/Retrieval.
When clicking ‘Test workflow’ manual n8n trigger.Loop Over Items n8n node ensures each file is processed sequentially. For every file, the Google Drive n8n node downloads the content as plain text.Default Data Loader registers the document, attaching crucial metadata (File ID and File Name) used for citations. The Recursive Character Text Splitter chops the text into optimized segments.Embeddings OpenAI1 n8n node converts these text chunks into high-dimensional vectors.Qdrant Vector Store n8n node inserts the vectors and their associated metadata into the specified Qdrant collection.When chat message received n8n trigger listens for user questions, initiating the retrieval process.Embeddings OpenAI4), and the Retrive sources Qdrant n8n node performs a similarity search, fetching the top 5 relevant document chunks (topK: 5).Question and Answer Chain n8n node. This chain uses the powerful Google Gemini Chat Model n8n node to synthesize the final answer.Aggregate n8n node collects all file IDs and names from the retrieved context. A custom Code n8n node then processes this list to extract and return only the unique file names, ensuring accurate and non-redundant citations.Set n8n node constructs the response, combining the generated text with the list of unique sources (file names), delivering a complete and verifiable response generated by the n8n workflow.To deploy this powerful RAG n8n workflow template, follow these steps:
Embeddings OpenAI n8n nodes, necessary for generating vector representations.Google Gemini Chat Model n8n node.Clear collection and Create collection n8n nodes (Host URL and API Key).Create collection and Clear collection HTTP Request n8n nodes, replace QDRANTURL and COLLECTION placeholders in the URL and JSON body with your actual Qdrant instance URL and desired collection name.Get folder n8n node is pointed to the folder containing your source documents (PDFs, Docs, etc.). Manual Trigger & Chat Trigger: The When clicking ‘Test workflow’ n8n trigger initializes the document ingestion phase. The When chat message received n8n trigger is the dedicated entry point for handling user queries in the RAG system.
Google Drive (Get folder/Get file): These n8n nodes manage document acquisition, fetching file lists and downloading individual document content for processing.
HTTP Request (Clear collection): This n8n node interacts directly with the Qdrant API to clear the vector collection before a fresh ingestion run, ensuring data hygiene.
Embeddings OpenAI: The dedicated n8n node responsible for transforming raw text chunks into numerical vector embeddings, using the standard text-embedding-ada-002 model expected by Qdrant.
Recursive Character Text Splitter: A LangChain n8n node that efficiently splits large documents into smaller, contextual chunks (500 size, 50 overlap), optimizing retrieval accuracy.
Qdrant Vector Store: This specialized n8n node handles both the data insertion (indexing phase) and the vector similarity search (retrieval phase) against the Qdrant vector database.
Google Gemini Chat Model: The n8n node providing the final generation capabilities, using the Gemini 1.5 Flash model to synthesize answers based on the context retrieved by the RAG system.
Code (Response): A critical custom n8n node using JavaScript to deduplicate and format the source file names gathered during retrieval, ensuring that the final output includes accurate and clean citations.
Build an advanced RAG chatbot using this n8n workflow. Connect Google Drive documents, use OpenAI embeddings, and store knowledge in a Supabase vector database for intelligent conversations.

Deploy a robust n8n workflow for a Question-Answering AI agent using RAG with Qdrant, Ollama embeddings, and local LLM execution via the MCP Server n8n trigger.

Deploy a custom AI Shopping Assistant using this sophisticated n8n workflow. Integrate Zep memory, GPT-4, and Google Sheets to instantly handle inventory checks, order tracking, and return policies.

Deploy a custom RAG system using this comprehensive n8n workflow, integrating Google Gemini's File Search API and LangChain nodes. Use this n8n template to easily upload documents and query them for context-aware answers.

Deploy a sophisticated RAG n8n workflow using Qdrant vector database, Mistral OCR for PDF ingestion, Cohere Reranker, and an OpenAI Agent. This n8n templates solution is built for accurate knowledge retrieval and robust LLM-as-a-Judge testing.

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at [email protected] or add me on Linkedin.com/in/davideboizza







































