RAG: context-aware chunking | Google Drive to Pinecone via OpenRouter & Gemini
Needs changesWhat this workflow does
This AI workflow has 13 nodes and runs manually, when you click “Execute workflow”. Along the way it connects OpenRouter Chat Model, Pinecone Vector Store, Embeddings Google Gemini and Google Drive.
How it runs
Trigger: Manually, when you click “Execute workflow”.
- Get Document From Google Drive (Google Drive): download
- Extract Text Data From Google Document (Extract from File): extracts data from a file (text)
- Split Document Text Into Sections (Code): runs custom JavaScript code
- Prepare Sections For Looping (Split Out): splits a list into separate items
- Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
- AI Agent: runs an AI agent, with model: OpenRouter Chat Model
- Concatenate the context and section text (Edit Fields (Set)): sets or maps fields
- Pinecone Vector Store: stores documents in the Pinecone vector store, with embeddings: Embeddings Google Gemini; document loader: Default Data Loader
Services it uses
Other Google Gemini + Google Drive templates (272) · Other Google Drive + OpenRouter templates (76) · Other Google Drive + Pinecone templates (65)
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 AI Agent - Prepare Context (v1.7): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
Published 2025 — 19% of 2025 templates need changes for 3.0. See how template age affects 3.0 readiness →
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Agent - Prepare Context (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (13)
- Manual Trigger
n8n-nodes-base.manualTrigger - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Pinecone Vector Store
@n8n/n8n-nodes-langchain.vectorStorePinecone - Embeddings Google Gemini
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Recursive Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - Google Drive
n8n-nodes-base.googleDrive - Extract from File
n8n-nodes-base.extractFromFile - Code
n8n-nodes-base.code - Split Out
n8n-nodes-base.splitOut - AI Agent
@n8n/n8n-nodes-langchain.agent - Edit Fields (Set)
n8n-nodes-base.set
From the author
Workflow based on the following article. https://www.anthropic.com/news/contextual-retrieval This n8n automation is designed to extract, process, and store content from documents into a Pinecone vector store using context-based chunking. The workflow enhances…