Automated RAG System for Document QA using Google Drive, Pinecone, and OpenAI - n8n Workflow

Build an automatic RAG system with this n8n workflow. Integrate Google Drive, OpenAI embeddings, and Pinecone vector database for real-time, context-aware document QA.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Organizations requiring an internal knowledge base or document QA system.

  • Data scientists or developers setting up Retrieval-Augmented Generation (RAG) pipelines.

  • Users looking for advanced n8n templates leveraging AI services and vector databases.

  • Automation specialists needing a reliable n8n workflow for continuous data ingestion.

Overview

This comprehensive n8n workflow solves the crucial challenge of keeping proprietary documentation current and searchable within an AI context. Instead of relying solely on general LLMs, this automation sets up a robust RAG architecture. It is split into two phases: document ingestion and querying. When a user drops a document into a designated Google Drive folder, the n8n automation pipeline seamlessly handles the downloading, chunking, embedding (using OpenAI), and vector storage (in Pinecone). By utilizing this specific n8n template, businesses can ensure their AI Agent has access to the latest internal data, dramatically improving the accuracy and relevance of AI-generated answers.

How it Works

The process is initiated by the Google Drive Trigger n8n trigger, which monitors a specific folder for new file creations.

Ingestion Flow


  1. The Google Drive Trigger fires upon a new file upload.

  2. The Download file n8n node fetches the binary content of the file.

  3. The Default Data Loader prepares the document, utilizing the Recursive Character Text Splitter n8n node to segment the file into manageable chunks (with an overlap of 100 characters).

  4. The Embeddings OpenAI n8n node generates dense vector representations of these text chunks.

  5. Finally, the Pinecone Vector Store n8n node inserts these vectors into the specified Pinecone index for long-term storage and retrieval.

Query Flow


  1. The When chat message received n8n trigger activates the RAG process when a user submits a query.

  2. The request is routed to the AI Agent n8n node. This agent orchestrates the response.

  3. It uses the OpenAI Chat Model (configured, for example, with gpt-4.1-mini) for language generation and the Simple Memory n8n node to maintain conversation context.

  4. Crucially, the AI Agent utilizes the Pinecone Vector Store1 n8n node as a retrieval tool, querying the knowledge base to pull relevant text chunks to answer the user’s question contextually. This entire process forms a powerful n8n workflow ready for deployment.

Installation Guide

To set up and run this n8n workflow, follow these steps:


  1. Import the Workflow: Copy the provided JSON data and import it into your n8n instance via the 'Workflows' section.

  2. Set Credentials: You must configure credentials for the three required services. Detailed instructions for creating these credentials are often found within the sticky notes of the n8n template itself:

Google Drive: Set up OAuth2 credentials in the Google Cloud Console to grant n8n access to your Drive files.
Pinecone: Obtain your API Key and Environment from your Pinecone dashboard.
* OpenAI: Generate a Secret API Key from your OpenAI account for embeddings and the chat model.

  1. Configure the Google Drive Trigger: In the Google Drive Trigger n8n trigger node, specify the ID of the folder you wish to monitor for new documents.

  2. Configure Pinecone Nodes: In both the 'Pinecone Vector Store' and 'Pinecone Vector Store1' n8n node instances, ensure you select the correct Pinecone index that you intend to use as your knowledge base.

  3. Activate: Ensure all credentials are set, save the n8n workflow, and activate it.

Node Details

This advanced n8n workflow leverages several specialized nodes:

Google Drive Trigger: The primary n8n trigger. Monitors a user-specified Google Drive folder for the 'fileCreated' event, initiating the entire ingestion process.
Download file (Google Drive): Fetches the file contents identified by the Google Drive Trigger, preparing it for processing.
Default Data Loader: Takes the file content and structures it for subsequent steps, utilizing the connected text splitter.
Recursive Character Text Splitter: Configured with a chunkOverlap of 100, this n8n node efficiently breaks down the lengthy document into smaller, manageable chunks for embedding.
Embeddings OpenAI: The dedicated n8n node responsible for converting text chunks into high-dimensional numerical vectors using the OpenAI embedding models.
Pinecone Vector Store: Used in the ingestion path (mode: insert). This n8n node uploads the vectors and associated metadata into the designated Pinecone index.
When chat message received (Chat Trigger): A webhook-based n8n trigger that listens for user queries, initiating the RAG retrieval and response phase.
OpenAI Chat Model: Provides the core reasoning and conversational capabilities for the AI Agent, configured to use a high-performance model.
Simple Memory: Maintains the state of the conversation, allowing the AI Agent n8n node to remember previous turns and provide coherent answers.
Pinecone Vector Store1: Used in the querying path (mode: retrieve-as-tool). This n8n node allows the AI Agent to search the vector database and retrieve the most relevant document chunks based on the user's query.


  • AI Agent: The central coordination n8n node. It manages the interaction between the language model, memory, and the Pinecone retrieval tool to formulate an informed answer.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all
Created by

I'm an Automation consultant with over 1 year of experience helping businesses to streamline their processes. Use my link to book an initial consultation for custom n8n work.

Featured*