Build a RAG system with automatic citations using Qdrant, Gemini & OpenAI
This workflow implements a Retrieval-Augmented Generation (RAG) system that: Stores vectorized documents in Qdrant, Retrieves relevant content based on user input, Generates AI answers using Google Gemini, Automatically cites the document sources (from Google Drive). --- Workflow Steps 1. Create Qdrant Collection A REST API node creates a new collection in Qdrant with specified vector size (1536) and cosine similarity. 2. Load Files from Google Drive The workflow lists all files in a Googl
At a glance
Build a RAG system with automatic citations using Qdrant, Gemini & OpenAI is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects OpenAI, Google Drive, LinkedIn, Gemini. It's free to download. Follow the 5-step import below to go live in minutes.
- Platform
- n8n
- Connects
- OpenAI, Google Drive, LinkedIn, Gemini
- Modules
- 24
- Price
- Free
- Version
- v1.0

About this workflow
This workflow implements a Retrieval-Augmented Generation (RAG) system that: Stores vectorized documents in Qdrant, Retrieves relevant content based on user input, Generates AI answers using Google Gemini, Automatically cites the document sources (from Google Drive). --- Workflow Steps 1. Create Qdrant Collection A REST API node creates a new collection in Qdrant with specified vector size (1536) and cosine similarity. 2. Load Files from Google Drive The workflow lists all files in a Google Drive folder, downloads them as plain text, and loops through each. 3. Text Preprocessing & Embedding Documents are split into chunks (500 characters, with 50-character overlap). Embeddings are created using OpenAI embeddings (text-embedding-3-small assumed). Metadata (file name and ID) is attached to each chunk. 4. Store in Qdrant All vectors, along with metadata, are inserted into the Qdrant collection. 5. Chat Input & Retrieval When a chat message is received, the question is embedded and matched against Qdrant. Top 5 relevant document chunks are retrieved. A Gemini model is used to generate the answer based on those sources. 6. Source Aggregation & Response File IDs and names are deduplicated. The AI response is combined with a list of cited documents (filenames). Final output: --- Main Advantages End-to-end Automation: From document ingestion to chat response generation, fully automated with no manual steps. Scalable Knowledge Base: Easy to expand by simply adding files to the Google Drive folder. Traceable Responses: Each answer includes its source files, increasing transparency and trustworthiness. Modular Design: Each step (embedding, storage, retrieval, response) is isolated and reusable. Multi-provider AI: Combines OpenAI (for embeddings) and Google Gemini (for chat), optimizing performance and flexibility. Secure & Customizable: Uses API credentials and configurable chunk size, collection name, etc. --- How It Works 1. Document Processing & Vectorization - The workflow retrieves documents from a specified Google Drive folder. - Each file is downloaded, split into chunks (using a recursive text splitter), and converted into embeddings via OpenAI. - The embeddings, along with metadata (file ID and name), are stored in a Qdrant vector database under the collection negozio-emporio-verde. 2. Query Handling & Response Generation - When a user submits a chat message, the workflow: - Embeds the query using OpenAI. - Retrieves the top 5 relevant document chunks from Qdrant. - Uses Google Gemini to generate a response based on the retrieved context. - Aggregates and deduplicates the source file names from the retrieved chunks. - The final output includes both the AI-generated response and a list of source documents (e.g., Sources: ["FAQ.pdf", "Policy.txt"]). --- Set Up Steps 1. Configure Qdrant Collection - Replace QDRANTURL and COLLECTION in the "Create collection" HTTP node to initialize the Qdrant collection with: - Vector size: 1536 (OpenAI embedding dimension). - Distance metric: Cosine. - Ensure the "Clear collection" node is configured to reset the collection if needed. 2. Google Drive & OpenAI Integration - Link the Google Drive node to the target folder (Test Negozio in this example). - Verify OpenAI and Google Gemini API credentials are correctly set in their respective nodes. 3. Metadata & Output Customization - Adjust the "Aggregate" and "Response" nodes if additional metadata fields are needed. - Modify the "Output" node to format the response (e.g., changing Sources: {{...}} to match your preferred style). 4. Testing - Trigger the workflow manually to test document ingestion. - Use the chat interface to verify responses include accurate source attribution. Note: Replace placeholder values (e.g., QDRANTURL) with actual endpoints before deployment. --- Need help customizing? Contact me for consulting and support or add me on Linkedin.
How to import this n8n workflow
- 1
Download the workflow JSON file after purchase.
- 2
Open n8n → click the menu → Import from File.
- 3
Select the downloaded JSON and import.
- 4
Set up credentials for each node that requires them.
- 5
Click Execute Workflow to test, then activate.
Setup guide
Setup guide included
Purchase to unlock the full step-by-step guide
Related N8n workflows
Send automated emails and add rows in Google Sheets using ChatGPT completions
Personalise outreach emails using customer data and AI
Create a code assistant that learns from your GitHub repository using OpenAI
Automate web research & analysis with Oxylabs & GPT for comprehensive reports
Search for and delete files in Google Drive automatically
Sort Gmail emails with GPT-4o into action required and no action labels
Stock market daily digest with Bright Data scraping & Gemini AI email reports
🎓 Optimize Speed-Critical Workflows Using Parallel Processing (Fan-Out/Fan-In)
Reviews
No reviews yet
Be the first to buy and share your experience.
Leave a review
Sign in to share your experience with this workflow.
Create a free account to purchase workflows.
- JSON blueprint — instant download
- Setup guide PDF included
- 5 downloads · valid 30 days
- Works with n8n
Need help setting this up?
Book a 3-hour live setup session with an Agility consultant.
- Configure live on Google Meet / Zoom
- Free follow-up if workflow has defects
- Platform expert assigned to you