# Document-based RAG chat assistant with Google Drive: n8n workflow

> Started by someone opening a chat with it, and works across Google Drive, Supabase and Supabase vectors.

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

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Document-based RAG chat assistant with Google Drive

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

Large Calls a model: OpenAI Retrieval

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

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

**2** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 4 Model 8 Logic 10 Service 10

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

- 1 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 2 **Embeddings OpenAI** Embeddings Open Ai *Model*
- 3 **Embeddings OpenAI1** Embeddings Open Ai *Model*
- 4 **Default Data Loader** Document Default Data Loader *Model*
- 5 **Update File** Google Drive trigger *Starts it*
- 6 **New File** Google Drive trigger *Starts it*
- 7 **Schedule Trigger** Schedule trigger *Starts it*
- 8 **Chat** Chat trigger *Starts it*
- 9 **Chat Memory** Memory Postgres Chat *Model*
- 10 **AI Agent** Agent *Model*
- 11 **Supabase Vector Store** Vector Store Supabase *Model*
- 12 **Supabase Vector Store1** Vector Store Supabase *Model*
- 13 **Edit Fields** Set *Logic*
- 14 **Edit Fields2** Set *Logic*
- 15 **Search files and folders** Google Drive *Service*
- 16 **Switch1** Switch *Logic*
- 17 **Delete a row** Supabase *Service*
- 18 **Download file** Google Drive *Service*
- 19 **Get many rows** Supabase *Service*
- 20 **Merge1** Merge *Logic*
- 21 **Extract From PDF** Extract From File *Service*
- 22 **Remove Duplicates** Remove Duplicates *Logic*
- 23 **Switch** Switch *Logic*
- 24 **Delete a row1** Supabase *Service*
- 25 **Edit Fields1** Set *Logic*
- 26 **Edit Fields4** Set *Logic*
- 27 **Extract from PDF** Extract From File *Service*
- 28 **Extract from Binary File** Extract From File *Service*
- 29 **Create folder** Google Drive *Service*
- 30 **Merge** Merge *Logic*
- 31 **Edit Fields3** Set *Logic*
- 32 **Upload file** Google Drive *Service*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 32, with 2 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Drive, Supabase, Supabase vectors
- **Model:** OpenAI
- **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, Supabase and Supabase vectors accounts, and a key for OpenAI. 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 OpenAI. 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 32 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 32 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%2Fdocument-based-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)[Supabase](https://millionrounds.com/workflows?service=Supabase#library)[Supabase vectors](https://millionrounds.com/workflows?service=Supabase+vectors#library)

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**AI knowledge assistant with Gemini and OpenAI** 32 steps · calls a model · Google Drive, Pinecone](https://millionrounds.com/workflow/ai-knowledge-assistant-with-gemini-and-openai)
- [**PDF RAG agent with Telegram** 32 steps · calls a model · Google Drive, Telegram](https://millionrounds.com/workflow/pdf-rag-agent-with-telegram)
- [**Sync Google Drive documents to Pinecone RAG with Gemini** 32 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/sync-google-drive-documents-to-pinecone-rag-with-gemini)
- [**Automate document approvals with Supabase and Gmail** 33 steps · Gmail, Supabase](https://millionrounds.com/workflow/automate-document-approvals-with-supabase-and-gmail)
- [**Send, chase, and e-signature with Airtable and TurboDocx** 33 steps · Airtable, Gmail](https://millionrounds.com/workflow/send-chase-and-e-signature-with-airtable-and-turbodocx)
- [**Chat with Google Drive and Pinecone** 30 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/chat-with-google-drive-and-pinecone)
