Sign Up/In: Visit the Supabase website and create an account
Create a Project
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE emails ( id SERIAL PRIMARY KEY, -- Unique ID for each email subject TEXT NOT NULL, -- Subject of the email sender TEXT NOT NULL, -- Email address of the sender recipient TEXT[] NOT NULL, -- Array of recipients cc TEXT[], -- Optional CC recipients bcc TEXT[], -- Optional BCC recipients body TEXT NOT NULL, -- Full body of the email (raw content) created_at TIMESTAMPTZ DEFAULT NOW() -- Timestamp when the email was sent or received );
CREATE TABLE email_sections ( id SERIAL PRIMARY KEY, -- Unique ID for each section email_id INT NOT NULL REFERENCES emails(id) ON DELETE CASCADE, -- Reference to parent email section_content TEXT NOT NULL, -- Content of the section (chunk) embedding VECTOR(1536), -- Embedding of the section section_order INT, -- Order of the section in the original email created_at TIMESTAMPTZ DEFAULT NOW() -- Timestamp for the section );
CREATE INDEX section_embedding_hnsw_idx ON email_sections USING hnsw (embedding vector_cosine_ops);
<style> img { border-radius: 50%; /* Makes the image round */ width: 256px; /* Ensures the width is consistent */ height: 256px; /* Ensures the height is consistent */ object-fit: cover; /* Ensures the image covers the area */ } </style>