Building first RAG system

Thanks.

I suppose I should have mentioned that the final ojbective is to create a chatbot.

My tentative workflow is as follows (noting that this for a MVP - testing a use case with low cost):

Layer Technology Purpose Implementation Details
Document Preprocessing Python + Regex + python-docx Semantic chunking Custom logic for headings, clauses, structure preservation. Run locally, upload to Supabase
Embedding Generation Hugging Face API from Edge Function Vector generation Deno-based edge function calling HF API for embeddings
Vector Storage Supabase pgvector Semantic search database Native PostgreSQL with vector similarity (same database)
Query Vectorization Hugging Face API Query-to-vector conversion Same API call from edge function
Chunk Retrieval Native SQL in Edge Function Top-K selection Direct SQL queries to pgvector within same Supabase instance
LLM Completion OpenAi/Claude/Gemini API Response generation API calls from Supabase edge functions
Frontend React/Next.js or WIX Chat interface Any frontend calling Supabase edge function endpoints
Backend Supabase Edge Functions Integrated serverless TypeScript/Deno functions with direct database access

Nb: Using Wix because I alread have an account. If I scale up, I’ll find better back and frontend solutions.

Anything glaringly off?