AutomationMart
Home/Browse/Build a RAG system with automatic citations using Qdrant, Gemini & OpenAI
n8n

Build a RAG system with automatic citations using Qdrant, Gemini & OpenAI

n8nn8n24 modulesv1.0
OpenAIGoogle DriveLinkedInGemini

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
Build a RAG system with automatic citations using Qdrant, Gemini & OpenAI workflow diagram

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.

n8n

How to import this n8n workflow

  1. 1

    Download the workflow JSON file after purchase.

  2. 2

    Open n8n → click the menu → Import from File.

  3. 3

    Select the downloaded JSON and import.

  4. 4

    Set up credentials for each node that requires them.

  5. 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

Automatically send personalized emails and add new rows in Google Sheets with ChatGPT. Triggered by new rows, this workflow enhances communication and data management.

Free

Personalise outreach emails using customer data and AI

This n8n template uses existing emails from customers as context to customise and "finetune" outreach emails to them using AI. By now, it should be common knowledge that we can leverage AI to generate unique emails but in a way, they can remain generic as the AI lacks the customer context to be truly personalised. One way to solve this is by pulling in a source of customer data - and what better way then by using existing email correspondence. How it works Customers to target are pulled from Hu

Free

Create a code assistant that learns from your GitHub repository using OpenAI

AI Agent for GitHub AI Agent to learn directly from your GitHub repository. It automatically syncs source files, converts them into vectorized knowledge How It Works Provide your GitHub repository — the workflow will automatically pull your source files and update the knowledge base (vectorstore) for the AI Agent. This allows the AI Agent to answer questions directly based on your repository’s content. --- How to Use 1. Commit your files to your GitHub repository. 2. Trigger the Sync Data wor

Free

Automate web research & analysis with Oxylabs & GPT for comprehensive reports

Fully automate deep research from start to finish: scrape Google Search results, select relevant sources, scrape & analyze each source in parallel, and generate a comprehensive research report. Who is this for? This workflow is for anyone who needs to research topics quickly and thoroughly: content creators, marketers, product managers, researchers, journalists, students, or anyone seeking deep insights without spending hours browsing websites. If you find yourself opening dozens of b

Free

Search for and delete files in Google Drive automatically

Automatically search and delete files in Google Drive. Trigger a search, feed results, and delete files using Google Drive modules in Make.

Free

Sort Gmail emails with GPT-4o into action required and no action labels

Description: This automation uses GPT-4o to scan unread Gmail emails and intelligently classify them as: Action → Requires your attention (reply, review, schedule, or respond) No Action → Informational or promotional; no action needed The result? You eliminate inbox noise and gain a clear daily routine: only check what's in Action Required. ⚙️ How It Works: Trigger: Runs on a customizable schedule Fetch Emails: Pulls unread messages from Gmail Classify via GPT-4o: Determines if each email n

Free

Stock market daily digest with Bright Data scraping & Gemini AI email reports

This workflow makes it easier to keep track of the stocks and get an email with a summary of the daily highlights on what happened, key insights and trends

Free

🎓 Optimize Speed-Critical Workflows Using Parallel Processing (Fan-Out/Fan-In)

How it works This template is a hands-on tutorial for one of the most advanced and powerful patterns in n8n: asynchronous parallel processing, also known as the Fan-Out/Fan-In model. When should you use this? Use this pattern when speed is your top priority and you have multiple independent, long-running tasks. Instead of running them one after another (which is slow), this workflow runs them all at the same time and waits for them all to finish. We use a Construction Project analogy to explain

Free

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.

Log in to review
Free
No ratings yet

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.

₹2,499/ session
3 hrs · video call
  • Configure live on Google Meet / Zoom
  • Free follow-up if workflow has defects
  • Platform expert assigned to you
Book installation session
Free