Skip to main content

Build a document QA system with Google Drive, Pinecone, and OpenAI RAG

Workflow preview

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

Important notice

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

1. Workflow Overview

Title RAG AI Agent for Documents in Google Drive → Pinecone → OpenAI Chat (n8n workflow) Short Description This n8n workflow implements a Retrieval Augmented Generation (RAG) pipeline + AI agent, a...

Best for

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

Tools used

n8n-nodes-base.googledrivetrigger, n8n-nodes-base.googledrive, @n8n/n8n-nodes-langchain.vectorstorepinecone, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, @n8n/n8n-nodes-langchain.chattrigger, @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 Abdullahi Ahmed.

Original n8n.io source

1.1 Workflow description

Title
Build a document QA system with Google Drive, Pinecone, and OpenAI RAG
Workflow name
Build a document QA system with Google Drive, Pinecone, and OpenAI RAG

Title

RAG AI Agent for Documents in Google Drive → Pinecone → OpenAI Chat (n8n workflow)


Short Description

This n8n workflow implements a Retrieval-Augmented Generation (RAG) pipeline + AI agent, allowing users to drop documents into a Google Drive folder and then ask questions about them via a chatbot. New files are indexed automatically to a Pinecone vector store using OpenAI embeddings; the AI agent loads relevant chunks at query time and answers using context plus memory.


Why this workflow matters / what problem it solves

  • Large language models (LLMs) are powerful, but they lack up-to-date, domain-specific knowledge.
  • RAG augments the LLM with relevant external documents, reducing hallucination and enabling precise answers. (Pinecone)
  • This workflow automates the ingestion, embedding, storage, retrieval, and chat logic — with minimal manual work.
  • It’s modular: you can swap data sources, vector DBs, or LLMs (with some adjustments).
  • It leverages the built-in AI Agent node in n8n to tie all the parts together. (n8n)

How to get the required credentials

Service Purpose in Workflow Setup Link What you need / steps
Google Drive (OAuth2) Trigger new file events & download the file https://docs.n8n.io/integrations/builtin/credentials/google/oauth-generic/ Create a Google Cloud OAuth app, grant it Drive scopes, get client ID & secret, configure redirect URI, paste into n8n credentials.
Pinecone Vector database for embeddings https://docs.n8n.io/integrations/builtin/credentials/pinecone/ Sign up at Pinecone, in dashboard create an index, get API key + environment, paste into n8n credential.
OpenAI Embeddings + chat model https://docs.n8n.io/integrations/builtin/credentials/openai/ Log in to OpenAI, generate a secret API key, paste into n8n credentials.

You’ll configure these under n8n → Credentials → New Credential, matching credential names referenced in your workflow nodes.


Detailed Walkthrough: How the Workflow Works

Here’s a step-by-step of what happens inside your workflow (matching your JSON):

1. Google Drive Trigger

  • Watches a specified folder in Google Drive. Whenever a new file appears (fileCreated event), the workflow is triggered (polling every minute).
  • You must set the folder ID (in “folderToWatch”) to the Drive folder you want to monitor.

2. Download File

  • Takes the file ID from the trigger and downloads the file content (binary).

3. Indexing Path: Embeddings + Storage

(This path only runs when new files arrive)

  • The file is sent to the Default Data Loader node (via the Recursive Character Text Splitter) to break it into chunks with overlap (so context is preserved).
  • Each chunk is fed into Embeddings OpenAI to convert text into embedding vectors.
  • Then Pinecone Vector Store (insert mode) ingests the vector + text metadata into your Pinecone index.
  • This ensures your vector store stays up-to-date with files you drop into Drive.

4. Chat / Query Path

(Triggered by user chat via webhook)

  • When a chat message arrives via When Chat Message Received, it gets passed into the AI Agent node.
  • Before generation, the AI Agent calls the Pinecone Vector Store1 set in “retrieve-as-tool” mode, which runs a vector-based retrieval using the user query embedding. The relevant text chunks are pulled as tools/context.
  • The OpenAI Chat Model node is linked as the language model for the agent.
  • Simple Memory node provides conversational memory (keeping history across messages).
  • The agent combines retrieved context + memory + user input and instructs the model to produce a response.

5. Connections / Flow Logic

  • The Embeddings OpenAI node’s output is wired into Pinecone Vector Store (insert) and also into Pinecone Vector Store1 (so the same embeddings can be used for retrieval).
  • The AI Agent has tool access to Pinecone retrieval and memory.
  • The Download File node triggers the insert path.
  • The When chat message triggers the agent path.

Similar Workflows / Inspirations & Comparisons

To help understand how your workflow fits into what’s already out there, here are a few analogues:

  • n8n Blog: “Build a custom knowledge RAG chatbot” — they show a workflow that ingests documents from external sources, indexes them in Pinecone, and responds to queries via n8n + LLM. (n8n Blog)
  • Index Documents from Google Drive to Pinecone — this is nearly identical for the ingestion part: trigger on Drive, split, embed, upload. (n8n)
  • Build & Query RAG System with Google Drive, OpenAI, Pinecone — shows the full RAG + chat logic, same pattern. (n8n)
  • Chat with GitHub API Documentation (RAG) — demonstrates converting API spec into chunks, embedding, retrieving, and chatting. (n8n)
  • Community tutorials & forums talk about using the AI Agent node with tools like Pinecone, and how the RAG part is often built as a sub-workflow feeding an agent. (n8n Community)

What sets your workflow apart is your explicit combination: Google Drive → automatic ingestion → chat agent with tool integration + memory. Many templates show either ingestion or chat, but fewer show them combined cleanly with n8n’s AI Agent.


Suggested Published Description (you can paste/adjust)

> RAG AI Agent for Google Drive Documents (n8n workflow) > > This workflow turns a Google Drive folder into a live, queryable knowledge base. Drop PDF, docx, or text files into the folder → new documents are automatically indexed into a Pinecone vector store using OpenAI embeddings → you can ask questions via a webhook chat interface and the AI agent will retrieve relevant text, combine it with memory, and answer in context. > > Credentials needed > > * Google Drive OAuth2 (see: https://docs.n8n.io/integrations/builtin/credentials/google/oauth-generic/) > * Pinecone (see: https://docs.n8n.io/integrations/builtin/credentials/pinecone/) > * OpenAI (see: https://docs.n8n.io/integrations/builtin/credentials/openai/) > > How it works > > 1. Drive trigger picks up new files > 2. Download, split, embed, insert into Pinecone > 3. Chat webhook triggers AI Agent > 4. Agent retrieves relevant chunks + memory > 5. Agent uses OpenAI model to craft answer > > This is built on the core RAG pattern (ingest → retrieve → generate) and enhanced by n8n’s AI Agent node for clean tool integration. > > Inspiration & context > This approach follows best practices from existing n8n RAG tutorials and templates, such as the “Index Documents from Google Drive to Pinecone” ingestion workflow and “Build & Query RAG System” templates. (n8n) > > You're free to swap out the data source (e.g. Dropbox, S3) or vector DB (e.g. Qdrant) as long as you adjust the relevant nodes.


If you like, I can generate a polished Markdown README for you (with badges, diagrams, instructions) ready for GitHub/n8n community publishing. Do you want me to build that?

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 - Google Drive Trigger

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

Block 2 - Download file

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

Block 3 - Pinecone Vector Store

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

Block 4 - Embeddings OpenAI

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

Block 5 - Default Data Loader

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

Block 6 - Recursive Character Text Splitter

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

Block 7 - When chat message received

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

Block 8 - OpenAI Chat Model

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

Block 9 - Simple Memory

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

Block 10 - Pinecone Vector Store1

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

Block 11 - Sticky Note

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

Block 12 - Sticky Note1

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

Block 13 - Sticky Note2

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

Block 14 - Sticky Note3

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

Block 15 - Sticky Note4

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

Block 16 - Sticky Note5

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

Block 17 - Sticky Note6

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

Block 18 - Sticky Note7

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

Block 19 - AI Agent

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

3. Summary Table

Workflow Build a document QA system with Google Drive, Pinecone, and OpenAI RAG
Complexity advanced
Nodes 19
Categories Internal Wiki, AI RAG
Author Abdullahi Ahmed
Published 28 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9050/9050.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 Google Drive, Pinecone, and OpenAI RAG do?

Title RAG AI Agent for Documents in Google Drive → Pinecone → OpenAI Chat (n8n workflow) Short Description This n8n workflow implements a Retrieval Augmented Generation (RAG) pipeline + AI agent, a...

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.