You are helping me build the following AI agent workflow. ## Goal RAG Chatbot with Supabase and TogetherAI: Ingests Google Docs into a vector database via Together AI and answers Telegram questions using only that retrieved context. ## Specification - What it does: Get instant answers to your questions via Telegram by asking about content stored in your Google Docs. The agent pulls only the relevant information from those documents to provide accurate responses without needing external knowledge. - Trigger: Triggered by an event (Event ยท on new Telegram message) - Autonomy: Fully hands-off - Expected setup effort: a few focused days - Tools/services involved: - Telegram: User interaction trigger and response delivery - Google Docs: Source document retrieval for training data - Supabase: Storing text chunks and vector embeddings - Together AI: Generating vector embeddings for text - OpenRouter Chat Model: LLM inference to generate answers from context ## Known pitfalls, handle each one explicitly in your implementation 1. Supabase vector search performance degrades without a proper index, so add an IVFFlat or HNSW index on the embedding column. 2. Google Docs API may return rich text HTML instead of plain text, so strip all HTML tags before chunking to avoid noise in embeddings. 3. Context window overflow occurs if too many chunks are retrieved, implement a relevance score threshold to filter out weak matches. ## Reference implementation https://n8n.io/workflows/5680 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/rag-chatbot-with-supabase-and-togetherai/ via usecasesforagents.com