# Build a dual-stage RAG chat assistant with Google Drive: n8n workflow

> Started by someone opening a chat with it, and works across Google Drive and Pinecone. It puts Gemini behind a retrieval step, so answers are drawn from...

Source: https://millionrounds.com/workflow/build-a-dual-stage-rag-chat-assistant-with-google-drive (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [AI assistants](https://millionrounds.com/workflows?category=AI+assistants#library)

# Build a dual-stage RAG chat assistant with Google Drive

Started by someone opening a chat with it, and works across Google Drive and Pinecone. It puts Gemini behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 27 steps, 2 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fbuild-a-dual-stage-rag-chat-assistant-with-google-drive)

**27 steps** Large: read it before trusting it with anything live

**2** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 3 Model 15 Logic 5 Service 4

The steps in the order they run, from what starts it.

- 1 **Manual Test Trigger** Manual trigger *Starts it*
- 2 **When File Updated in Drive** Google Drive trigger *Starts it*
- 3 **Generate Ollama Embeddings** Embeddings Ollama *Model*
- 4 **Load Data for Ingestion** Document Default Data Loader *Model*
- 5 **On Chat Message Received** Chat trigger *Starts it*
- 6 **Cache Query with Ollama** Embeddings Ollama *Model*
- 7 **Google Chat Model for Agent** Lm Chat Google Gemini *Model*
- 8 **Manage Simple Memory** Memory Buffer Window *Model*
- 9 **Google Chat Model for Tool** Lm Chat Google Gemini *Model*
- 10 **Fetch Ollama Knowledge Embeddings** Embeddings Ollama *Model*
- 11 **Store Embeddings in Cache** Embeddings Ollama *Model*
- 12 **Cache Storage Data Loader** Document Default Data Loader *Model*
- 13 **Search Drive Files** Google Drive *Service*
- 14 **Store Knowledge in Pinecone** Vector Store Pinecone *Model*
- 15 **Lookup in Semantic Cache** Vector Store Pinecone *Model*
- 16 **AI Query Response Agent** Agent *Model*
- 17 **Vector Store Question Answering** Tool Vector Store *Model*
- 18 **Retrieve Knowledge from Pinecone** Vector Store Pinecone *Model*
- 19 **Store Answer in Semantic Cache** Vector Store Pinecone *Model*
- 20 **Download Drive File** Google Drive *Service*
- 21 **Evaluate JavaScript Cache** Code *Logic*
- 22 **Check If PDF** If *Logic*
- 23 **Check Cache Hit** If *Logic*
- 24 **Extract PDF Content** Extract From File *Service*
- 25 **Extract Text Content** Extract From File *Service*
- 26 **Set Cached Answer** Set *Logic*
- 27 **Merge Extracted Content** Merge *Logic*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 27, with 2 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Drive, Pinecone
- **Model:** Gemini
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Google Drive and Pinecone accounts, and a key for Gemini. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls Gemini. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 27 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 27 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fbuild-a-dual-stage-rag-chat-assistant-with-google-drive)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)[Pinecone](https://millionrounds.com/workflows?service=Pinecone#library)

## Workflows like it

Also ai assistants, with the same services where possible, closest in size first.

- [**Place products on AI generated backgrounds with Google Imagen** 27 steps · calls a model · Google Drive](https://millionrounds.com/workflow/place-products-on-ai-generated-backgrounds-with-google-image)
- [**Voice AI chatbot with OpenAI and RAG** 27 steps · calls a model · Google Drive, Qdrant](https://millionrounds.com/workflow/voice-ai-chatbot-with-openai-and-rag)
- [**Dynamic website assistant with DeepSeek** 28 steps · calls a model · Pinecone](https://millionrounds.com/workflow/dynamic-website-assistant-with-deepseek)
- [**Generate LinkedIn carousel images from text with Mistral** 26 steps · calls a model · Google Drive, S3](https://millionrounds.com/workflow/generate-linkedin-carousel-images-from-text-with-mistral)
- [**WhatsApp unofficial AI bot with Groq and Pinecone** 26 steps · calls a model · Pinecone, Redis](https://millionrounds.com/workflow/whatsapp-unofficial-ai-bot-with-groq-and-pinecone)
- [**AI inbox assistant with OpenAI and Gmail** 25 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/ai-inbox-assistant-with-openai-and-gmail)
