Skip to main content

Build a document QA system with RAG using Milvus, Cohere, and OpenAI for Google Drive

Workflow preview

Workflow preview
100%
Build a document QA system with RAG using Milvus, Cohere, and OpenAI for Google Drive preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Template Description This template creates a powerful Retrieval Augmented Generation (RAG) AI agent workflow in n8n. It monitors a specified Google Drive...

Best for

  • Internal Wiki automation workflows
  • AI RAG automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.embeddingscohere, @n8n/n8n-nodes-langchain.chattrigger, n8n-nodes-base.googledrivetrigger, n8n-nodes-base.googledrive, @n8n/n8n-nodes-langchain.vectorstoremilvus, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Aitor | 1Node.

Original n8n.io source

1.1 Workflow description

Title
Build a document QA system with RAG using Milvus, Cohere, and OpenAI for Google Drive
Workflow name
Build a document QA system with RAG using Milvus, Cohere, and OpenAI for Google Drive

Template Description

This template creates a powerful Retrieval Augmented Generation (RAG) AI agent workflow in n8n. It monitors a specified Google Drive folder for new PDF files, extracts their content, generates vector embeddings using Cohere, and stores these embeddings in a Milvus vector database. Subsequently, it enables a RAG agent that can retrieve relevant information from the Milvus database based on user queries and generate responses using OpenAI, enhanced by the retrieved context.

Functionality

The workflow automates the process of ingesting documents into a vector database for use with a RAG system.

  1. Watch New Files: Triggers when a new file (specifically targeting PDFs) is added to a designated Google Drive folder.

  2. Download New: Downloads the newly added file from Google Drive.

  3. Extract from File: Extracts text content from the downloaded PDF file.

  4. Default Data Loader / Set Chunks: Processes the extracted text, splitting it into manageable chunks for embedding.

  5. Embeddings Cohere: Generates vector embeddings for each text chunk using the Cohere API.

  6. Insert into Milvus: Inserts the generated vector embeddings and associated metadata into a Milvus vector database.

  7. When chat message received: Adapt the trigger tool to fit your needs.

  8. RAG Agent: Orchestrates the RAG process.

  9. Retrieve from Milvus: Queries the Milvus database with the user's chat query to find the most relevant chunks.

  10. Memory: Manages conversation history for the RAG agent to optimize cost and response speed.

  11. OpenAI / Cohere embeddings: Uses ChatGPT 4o for text generation.

Requirements

To use this template, you will need:

  • An n8n instance (cloud or self-hosted).

  • Access to a Google Drive account to monitor a folder.

  • A Milvus instance or access to a Milvus cloud service like Zilliz.

  • A Cohere API key for generating embeddings.

  • An OpenAI API key for the RAG agent's text generation.

Usage

  1. Set up the required credentials in n8n for Google Drive, Milvus, Cohere, and OpenAI.

  2. Configure the "Watch New Files" node to point to the Google Drive folder you want to monitor for PDFs.

  3. Ensure your Milvus instance is running and the target cluster is set up correctly.

  4. Activate the workflow.

  5. Add PDF files to the monitored Google Drive folder. The workflow will automatically process them and insert their embeddings into Milvus.

  6. Interact with the RAG agent. The agent will use the data in Milvus to provide context-aware answers.

Benefits

  • Automates document ingestion for RAG applications.

  • Leverages Milvus for high-performance vector storage and search.

  • Uses Cohere for generating high-quality text embeddings.

  • Enables building a context-aware AI agent using your own documents.

Suggested improvements

  • Support for More File Types: Extend the "Watch New Files" node and subsequent extraction steps to handle various document types (e.g., .docx, .txt, .csv, web pages) in addition to PDFs.

  • Error Handling and Notifications: Implement robust error handling for each step of the workflow (e.g., failed downloads, extraction errors, Milvus insertion failures) and add notification mechanisms (e.g., email, Slack) to alert the user.

Get in touch with us

Contact us at https://1node.ai

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 2 - Embeddings Cohere

Type / Role
@n8n/n8n-nodes-langchain.embeddingsCohere - embeddingsCohere
Config choices
Version 1

Block 3 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 4 - Watch New Files

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 5 - Download New

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 6 - Insert into Milvus

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreMilvus - vectorStoreMilvus
Config choices
Version 1.1

Block 7 - RAG Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 8 - Retrieve from Milvus

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreMilvus - vectorStoreMilvus
Config choices
Version 1.1

Block 9 - OpenAI 4o

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 10 - Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 11 - Cohere embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsCohere - embeddingsCohere
Config choices
Version 1

Block 12 - Set Chunks

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 13 - Extract from File

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 14 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Build a document QA system with RAG using Milvus, Cohere, and OpenAI for Google Drive
Complexity intermediate
Nodes 14
Categories Internal Wiki, AI RAG
Author Aitor | 1Node
Published 03 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3848/3848.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Build a document QA system with RAG using Milvus, Cohere, and OpenAI for Google Drive do?

Template Description This template creates a powerful Retrieval Augmented Generation (RAG) AI agent workflow in n8n. It monitors a specified Google Drive...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI RAG use case.