RAG chatbot with Supabase + TogetherAI + Openrouter
⚠️ RUN the FIRST WORKFLOW ONLY ONCE (as it will convert your content in Embedding format and save it in DB and is ready for the RAG Chat)
⚠️ RUN the FIRST WORKFLOW ONLY ONCE
(as it will convert your content in Embedding format and save it in DB and is ready for the RAG Chat)
📌 Telegram Trigger
- ▪Type:
telegramTrigger - ▪Purpose: Waits for new Telegram messages to trigger the workflow.
- ▪Note: Currently disabled.
📄 Content for the Training
- ▪Type:
googleDocs - ▪Purpose: Fetches document content from Google Docs using its URL.
- ▪Details: Uses Service Account authentication.
✂️ Splitting into Chunks
- ▪Type:
code - ▪Purpose: Splits the fetched document text into smaller chunks (1000 chars each) for processing.
- ▪Logic: Loops over text and slices it.
🧠 Embedding Uploaded Document
- ▪Type:
httpRequest - ▪Purpose: Calls Together AI embedding API to get vector embeddings for each text chunk.
- ▪Details: Sends JSON with model name and chunk as input.
🛢 Save the embedding in DB
- ▪Type:
supabase - ▪Purpose: Saves each text chunk and its embedding vector into the Supabase
embedtable.
SECOND WORKFLOW EXPLAINATION:
💬 When chat message received
- ▪Type:
chatTrigger - ▪Purpose: Starts the workflow when a user sends a chat message.
- ▪Details: Sends an initial greeting message to the user.
🧩 Embend User Message
- ▪Type:
httpRequest - ▪Purpose: Generates embedding for the user’s input message.
- ▪Details: Calls Together AI embeddings API.
🔍 Search Embeddings
- ▪Type:
httpRequest - ▪Purpose: Searches Supabase DB for the top 5 most similar text chunks based on the generated embedding.
- ▪Details: Calls Supabase RPC function
matchembeddings1.
📦 Aggregate
- ▪Type:
aggregate - ▪Purpose: Combines all retrieved text chunks into a single aggregated context for the LLM.
🧠 Basic LLM Chain
- ▪Type:
chainLlm - ▪Purpose: Passes the user's question + aggregated context to the LLM to generate a detailed answer.
- ▪Details: Contains prompt instructing the LLM to answer only based on context.
🤖 OpenRouter Chat Model
- ▪Type:
lmChatOpenRouter - ▪Purpose: Provides the actual AI language model that processes the prompt.
- ▪Details: Uses
qwen/qwen3-8b:freemodel via OpenRouter and you can use any of your choice.
production deployment
Need this workflow deployed or tailored for your business?
I customize n8n pipelines, build proprietary API nodes, and connect production databases with sub-100ms reliability.
creator
iamvaar
Top 50 Verified Creator
AI Automation Engineer building production-grade n8n systems, custom nodes, and LLM pipelines.
n8n.io/creators/iamvaarspecs
related automations
More workflows from iamvaar
Build a knowledge-based WhatsApp assistant with RAG, Gemini, Supabase & Google Docs
Workflow Execution Link: Watch Execution Video(https://youtu.be/NUWeQywOMTw?si=7slubwmqYqs2m6sh)
Build a knowledge base chatbot with Jotform, RAG Supabase, Together AI & Gemini
Youtube Video: https://youtu.be/dEtV7OYuMFQ?si=fOAlZWz4aDuFFovH(https://youtu.be/dEtV7OYuMFQ?si=fOAlZWz4aDuFFovH)
Route weather-based delivery holds with Open-Meteo, Gemini, Postgres, and ServiceNow
Quick overview Demo Video: https://youtu.be/ccEy0J-LKY
Want this workflow running in your stack?
Book a free 30-minute session. I'll inspect your current infrastructure, review required API credentials, and map out the deployment.