Quick Overview
This workflow indexes text files from Microsoft OneDrive into a Supabase vector store using OpenAI embeddings, then answers incoming webhook questions with a Groq LLM using retrieval-augmented generation (RAG) and returns the response to the caller.
How it works
- Runs on a daily schedule at 02:00 or starts manually to re-index documents.
- Lists files in a specified OneDrive folder via the Microsoft Graph API and iterates through each file.
- Downloads each OneDrive file, loads its text content, generates OpenAI embeddings, and stores the resulting chunks in a Supabase vector store table.
- Receives a POST request on a webhook containing a question in
body.chatInput.
- Creates an embedding for the question, retrieves the top matching chunks from Supabase, and uses Groq (Llama 3.1) to generate a structured answer based on the retrieved context.
- Returns the generated answer as the webhook response.
Setup
- Create a Microsoft OneDrive OAuth2 credential and update the Microsoft Graph folder path in the OneDrive listing request URL.
- Add an OpenAI API key for embeddings and ensure the same embeddings model is used for both indexing and querying.
- Set up Supabase credentials and a
documents table (with the configured match_documents query/function) for the Supabase vector store.
- Add a Groq API key and confirm the Groq model selection and prompt content match your voice-assistant use case.
- Copy the webhook URL and configure the calling system to send POST requests with a JSON body like
{ "chatInput": "..." }.