Skip to main content

Build a RAG system for PDF documents with Google Drive, Unstructured, and OpenAI

Workflow preview

Workflow preview
100%
Build a RAG system for PDF documents with Google Drive, Unstructured, and OpenAI preview
Open on n8n.io

Important notice

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

1. Workflow Overview

This template monitors a Google Drive folder, converts PDF documents into clean text chunks with Unstructured, generates OpenAI embeddings, and upserts vectors into Pinecone. It’s a practical, prod...

Best for

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

Tools used

n8n-nodes-base.httprequest, n8n-nodes-base.code, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.chattrigger, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.vectorstorepinecone, @n8n/n8n-nodes-langchain.embeddingsopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Tomas Lubertino.

Original n8n.io source

1.1 Workflow description

Title
Build a RAG system for PDF documents with Google Drive, Unstructured, and OpenAI
Workflow name
Build a RAG system for PDF documents with Google Drive, Unstructured, and OpenAI

This template monitors a Google Drive folder, converts PDF documents into clean text chunks with Unstructured, generates OpenAI embeddings, and upserts vectors into Pinecone. It’s a practical, production-ready starting point for Retrieval-Augmented Generation (RAG) that you can plug into a chatbot, semantic search, or internal knowledge tools.

How it works

  1. Google Drive Trigger detects new files in a selected folder and downloads them.
  2. The files are sent to Unstructured where they are split into smaller pieces (chunks).
  3. The chunks are prepared to be sent to OpenAI where they are converted into vectors (embeddings).
  4. The embeddings are recombined with their original data and the payload is prepared for upsert into the Pinecone index.

Set up steps

  1. In Pinecone, create an index with 1536 dimensions and configure it for text-embedding-3-small.
  2. Copy the host url and paste it on the 'Pinecone Upsert' node. It should look something like this: https://{your-index-name}.pinecone.io/vectors/upsert.
  3. Add Google Drive, OpenAI and Pinecone credentials in n8n.
  4. Point the trigger to your ingest folder (you can use this article for demo).
  5. Click the 'Open chat' button and enter the following: Which Git provider do the authors use?

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 - Unstructured Extract

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4

Block 2 - Map Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - HTTP OpenAI Embeddings

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4

Block 4 - Pack

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - Re-expand

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Pinecone Upsert

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4

Block 7 - Sticky Note1

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

Block 8 - When chat message received

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

Block 9 - Question & Answer

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

Block 10 - OpenAI Chat Model

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

Block 11 - Pinecone Vector Store

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

Block 12 - Embeddings OpenAI

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

Block 13 - Simple Memory

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

Block 14 - Prepare Data for Upsert

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Sticky Note2

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

Block 16 - Google Drive Download

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

Block 17 - Google Drive Trigger

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

Block 18 - Sticky — Template Overview (Global)

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

3. Summary Table

Workflow Build a RAG system for PDF documents with Google Drive, Unstructured, and OpenAI
Complexity advanced
Nodes 18
Categories Internal Wiki, AI RAG
Author Tomas Lubertino
Published 06 Nov 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10577/10577.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 RAG system for PDF documents with Google Drive, Unstructured, and OpenAI do?

This template monitors a Google Drive folder, converts PDF documents into clean text chunks with Unstructured, generates OpenAI embeddings, and upserts vectors into Pinecone. It’s a practical, prod...

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.