AI Study Assistant with RAG - Google Gemini with Drive & Supabase Vector Search

Go to Workflow
0 views
Built by Mantaka Mahir Mantaka Mahir
Created on June 05, 2026

Description

How it works

A complete AI-powered study assistant system that lets you chat naturally with your documents stored in Google Drive:

The system has two connected workflows:

1. Document Indexing Pipeline (Sub-workflow):
• Accepts Google Drive folder URLs
• Automatically fetches all files from the folder
• Converts documents to plain text
• Generates 768-dimensional embeddings using Google Gemini
• Stores everything in Supabase vector database for semantic search

2. Study Chat Agent (Main workflow):
• Provides a conversational chat interface
• Automatically detects and processes Google Drive links shared in chat
• Searches your indexed documents using semantic similarity
• Maintains conversation history across sessions
• Includes calculator for math problems
• Responds naturally using Google Gemini 2.5 Pro

Use Cases: Students studying for exams, researchers managing papers, professionals building knowledge bases, anyone needing to query large document collections conversationally.

Set up steps

Prerequisites:
• Google Drive OAuth2 credentials
• Google Gemini API key (free tier available)
• Supabase account with Postgres connection
• ~15 minutes setup time

Complete Setup:

Part 1: Document Indexing Workflow
Add Google Drive OAuth2 credentials to the Drive nodes
Configure Supabase Postgres credentials in the SQL node
Add Supabase API credentials to the Vector Store node
Add Google Gemini API key to the Embeddings node

Part 2: Study Agent Workflow
Import the Study Agent workflow
Verify the "Folder all file to vector" tool links to the indexing workflow
Add Google Gemini API credentials to both Gemini nodes
Configure Supabase API credentials in the Vector Store node
Add Postgres credentials for Chat Memory
Deploy and access the chat via webhook URL

How to Use:
Open the chat interface (webhook URL)
Paste a Google Drive folder link in the chat
Wait for indexing to complete (~1-2 minutes)
Start asking questions about your documents
The AI will search and answer from your materials

Note: The indexing workflow runs automatically when you share Drive links in chat, or you can run it manually to pre-load documents.

System Components:
Main Agent:** Gemini 2.5 Pro with conversational AI
Vector Search:** Supabase with pgvector (768-dim embeddings)
Memory:** Postgres chat history (10-message context window)
Tools:** Document retrieval, Drive indexing, calculator
Embedding Model:** Google Gemini text-embedding-004

Nodes Used (11)

AI Agent
@n8n/n8n-nodes-langchain.agent
Calculator
@n8n/n8n-nodes-langchain.toolCalculator
Call n8n Workflow Tool
@n8n/n8n-nodes-langchain.toolWorkflow
Code
n8n-nodes-base.code
Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader
Embeddings Google Gemini
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini
Google Drive
n8n-nodes-base.googleDrive
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
Postgres
n8n-nodes-base.postgres
Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat
Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase