Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / RAG & Knowledge Bases

RAG & Knowledge Bases

Two-Stage Document Retrieval Chatbot with OpenAI and Supabase

When a chat message arrives, this finds relevant files by similarity in Supabase, then retrieves their content for OpenAI to answer from.

What it does

### Files table create table public.files ( id uuid not null default gen_random_uuid (), name text null, category text null, date_created timestamp with time zone null default (now() AT TIME ZONE 'utc'::text), google_drive_url text null, theme text null, description text null, embedding extensions.vector null, google_drive_id text null, status text null default 'ready'::text, type public.file_type null, video_transcription_url text null, constraint files_pkey primary key (id) ) TABLESPACE pg_default;

The steps

  1. Database retrieval1
  2. When chat message received
  3. OpenAI
  4. GetFile
  5. UpdateEmbedding
  6. OpenAI CreateEmbeddings
  7. When clicking ‘Execute workflow’
  8. Find Files
  9. Filter similarity
  10. Aggregate files
  11. Set Output

Similar automations