RAG:Context-Aware Chunking | Google Drive to Pinecone via OpenRouter & Gemini n8n Workflow Template

n8n workflow template · 13 nodes · OpenRouter

RAG:Context-Aware Chunking | Google Drive to Pinecone via OpenRouter & Gemini is a free n8n workflow template that starts when you run it manually in the n8n editor and works with OpenRouter, Pinecone, Google Gemini and Google Drive. It has 13 nodes, 6 of them AI nodes (OpenRouter Chat Model, Pinecone Vector Store, Google Gemini Embeddings and Default Data Loader). The notes inside the workflow say: “In this section, the agent node will prepare context for a section (chunk of text), which will then be passed for conversion into a vectors along with the section itself.” To run it, you add your own credentials for Google Drive OAuth2, Google Gemini (PaLM) API, Open Router API and Pinecone API.

At a glance

Trigger
Manual Trigger (When clicking ‘Test workflow’)
Nodes
13
Apps
OpenRouter, Pinecone, Google Gemini and Google Drive
AI nodes
6
Credentials
4 types
Category
RAG, documents and vector search

Apps and integrations

  • OpenRouter
  • Pinecone
  • Google Gemini
  • Google Drive

Node types used

  • Manual Trigger
  • Loop Over Items
  • OpenRouter Chat Model
  • Pinecone Vector Store
  • Google Gemini Embeddings
  • Default Data Loader
  • Recursive Character Text Splitter
  • Google Drive
  • Extract from File
  • Code
  • Split Out
  • AI Agent
  • Edit Fields (Set)

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Prepare context

In this section, the agent node will prepare context for a section (chunk of text), which will then be passed for conversion into a vectors along with the section itself.

Prepare Document.

This section is responsible for downloading the file from Google Drive, splitting the text into sections by detecting separators, and preparing them for looping.

Convert Text To Vectors

In this step, the Pinecone node converts the provided text into vectors using Google Gemini and stores them in the Pinecone vector database.

Nodes in this workflow

The 13 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. When clicking ‘Test workflow’ (Manual Trigger)
  2. Loop Over Items (Loop Over Items)
  3. OpenRouter Chat Model (OpenRouter Chat Model)
  4. Pinecone Vector Store (Pinecone Vector Store)
  5. Embeddings Google Gemini (Google Gemini Embeddings)
  6. Default Data Loader (Default Data Loader)
  7. Recursive Character Text Splitter (Recursive Character Text Splitter)
  8. Get Document From Google Drive (Google Drive)
  9. Extract Text Data From Google Document (Extract from File)
  10. Split Document Text Into Sections (Code)
  11. Prepare Sections For Looping (Split Out)
  12. AI Agent - Prepare Context (AI Agent)
  13. Concatenate the context and section text (Edit Fields (Set))

Credentials you need

  • Google Drive OAuth2 – used by Get Document From Google Drive
  • Google Gemini (PaLM) API – used by Embeddings Google Gemini
  • Open Router API – used by OpenRouter Chat Model
  • Pinecone API – used by Pinecone Vector Store

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us