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

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

Needs changes

by Tomas Lubertino · 821 views · created 2025-11-06 · Internal Wiki, AI RAG

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 15 nodes and runs on Google Drive events (file created) (plus 1 other trigger). Along the way it connects OpenAI Chat Model, Pinecone Vector Store, Embeddings OpenAI and Google Drive. It also calls unstructured:8000 and api.openai.com over HTTP.

How it runs

Trigger: On Google Drive events (file created) (plus 1 other trigger).

  1. Google Drive: download
  2. Question & Answer (AI Agent): runs an AI agent, with model: OpenAI Chat Model; 1 tool (Pinecone Vector Store); memory: Simple Memory
  3. Unstructured Extract (HTTP Request): calls unstructured:8000 (POST)
  4. Map Data (Code): runs custom JavaScript code
  5. Pack (Code): runs custom JavaScript code
  6. HTTP OpenAI Embeddings (HTTP Request): calls api.openai.com (POST)
  7. Re-expand (Code): runs custom JavaScript code
  8. Prepare Data for Upsert (Edit Fields (Set)): sets 2 fields: id, metadata
  9. Pinecone Upsert (HTTP Request): calls an HTTP API (POST)

Services it uses

OpenAI Chat ModelPinecone Vector StoreEmbeddings OpenAIGoogle Drive

HTTP calls to: unstructured:8000, api.openai.com

Before you upgrade to n8n 3.0

1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:

  • AI Agent v1 (old agent modes) in Question & Answer (v1.8): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Removed in 3.0Replace with
AI Agent v1 (old agent modes)
Question & Answer (v1.8)
Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Nodes used (11)

From the author

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…

Excerpt from Tomas Lubertino's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.