Automation library · Data collection

Build a RAG knowledge base from PDFs with Gemini and Supabase

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

LargeCalls a model: GeminiRetrieval

27 stepsLarge: read it before trusting it with anything live
3Branches: places the flow splits
2Loops or waits
3Services it connects to

The flow

Starts it 2Model 8Logic 10Service 7

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

  1. 1Recursive Text SplitterText Splitter Recursive Character Text SplitterModel
  2. 2Embeddings Google GeminiEmbeddings Google GeminiModel
  3. 3Schedule TriggerSchedule triggerStarts it
  4. 4Gemini Flash (RAG)Lm Chat Google GeminiModel
  5. 5Gemini Embeddings (Query)Embeddings Google GeminiModel
  6. 6When chat message receivedChat triggerStarts it
  7. 7PDF Binary LoaderDocument Default Data LoaderModel
  8. 8Insert to Supabase pgvectorVector Store SupabaseModel
  9. 9Get row(s) in sheetGoogle SheetsService
  10. 10SerajUAE RAG AgentAgentModel
  11. 11SerajUAE Knowledge BaseVector Store SupabaseModel
  12. 12Update row in sheetGoogle SheetsService
  13. 13FilterFilterLogic
  14. 14Loop Over ItemsSplit In BatchesLogic
  15. 15All DoneSetLogic
  16. 16Seraj or Drive?IfLogic
  17. 17Fetch File PageHttp RequestService
  18. 18Extract Drive File ID + TitleCodeLogic
  19. 19Extract PDF URL + TitleCodeLogic
  20. 20Download PDF (Drive)Google DriveService
  21. 21Drive Link?IfLogic
  22. 22WaitWaitLogic
  23. 23Download PDF (Seraj)Http RequestService
  24. 24Extract from FileExtract From FileService
  25. 25Code in JavaScriptCodeLogic
  26. 26text pdf?IfLogic
  27. 27Update row in sheet1Google SheetsService

How it's built

Starts on
Someone opening a chat with it
Steps
27, with 3 branches, 2 loops or waits
Size
Large: read it before trusting it with anything live
Connects to
Google Drive, Google Sheets, Supabase vectors
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, Google Sheets and Supabase vectors 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.