AK
← All projects

AI Automation

RAG Study Assistant from a School Textbook (Supabase)

A chat assistant built on my son's Class 4 Bangladesh & Global Studies textbook. The PDF is embedded into a Supabase vector store, and the agent answers questions and prepares practice lessons from it.

n8nOpenAISupabase Vector StorePostgres Chat MemoryGoogle DrivePDF
n8n workflow — Google Drive file ingested into Supabase Vector Store, and a chat agent with Postgres memory and a vector store tool

How it flows

  1. 1Download the textbook PDF from Google Drive
  2. 2Split, embed, and store 171 chunks in Supabase
  3. 3Student asks a question in chat
  4. 4Agent searches the vector store and answers from the book
  5. 5Postgres keeps the conversation history

Why this project

After building the Pinecone email agent, I wanted to test the same idea on something my family would actually use, and on an open, self-hostable stack. Supabase gives a Postgres database with the pgvector extension, which can hold both the vectors and the chat history.

The document is my son’s Class 4 Bangladesh and Global Studies (BGS) textbook.

How it works

Ingestion — a manual trigger downloads the PDF from Google Drive. The Default Data Loader reads it, and OpenAI Embeddings convert it into 171 chunks that are inserted into the Supabase Vector Store.

Chat — a chat trigger passes the message to an AI Agent with three attachments: the OpenAI chat model, Postgres Chat Memory, and the Supabase Vector Store exposed as a tool. The agent retrieves the most relevant chunks and answers only from them.

What it can do

  • Answer any question from the textbook in simple language
  • Prepare a practice lesson for a chapter
  • Generate quiz questions and check the answers
  • Remember the earlier part of the conversation (“explain that again more simply”)

Result

A working study helper for a real student, and proof that the RAG pattern in n8n is portable — swapping Pinecone for Supabase took only a few nodes.