Hi no-coders! Welcome to the 1st part of this course. In this part, we will first prepare our Supabase vector database and OpenAI for the embeddings of your information from PDFs and websites.
<aside> <img src="https://prod-files-secure.s3.us-west-2.amazonaws.com/add94f13-0c11-4513-b858-09cbb60c3da1/78b88657-fcdb-429f-815b-c600b51d81ea/Supabase.png" alt="https://prod-files-secure.s3.us-west-2.amazonaws.com/add94f13-0c11-4513-b858-09cbb60c3da1/78b88657-fcdb-429f-815b-c600b51d81ea/Supabase.png" width="40px" /> ——————————————————————————————————————————————
Step 1: Create a Supabase account for free. You can use email or Github. I would recommend Github since a Github account will be needed for hosting Flowise in part 2
Step 2: Create a new project. Note down your Project API key and URL which are needed in part 2. You can locate it in your project settings > API
Step 3: Head to SQL Editor tab and click “+ New query” and rename the untitled query as “match_documents”
Step 4: Copy and paste the following code into the editor
-- Enable the pgvector extension to work with embedding vectors
create extension vector;
-- Create a table to store your documents
create table documents (
id bigserial primary key,
content text, -- corresponds to Document.pageContent
metadata jsonb, -- corresponds to Document.metadata
embedding vector(1536) -- 1536 works for OpenAI embeddings, change if needed
);
-- Create a function to search for documents
create function match_documents (
query_embedding vector(1536),
match_count int DEFAULT null,
filter jsonb DEFAULT '{}'
) returns table (
id bigint,
content text,
metadata jsonb,
similarity float
)
language plpgsql
as $$
#variable_conflict use_column
begin
return query
select
id,
content,
metadata,
1 - (documents.embedding <=> query_embedding) as similarity
from documents
where metadata @> filter
order by documents.embedding <=> query_embedding
limit match_count;
end;
$$;
Step 5: Hit run and now you will have a vector data table named “documents” and a query named “match_documents” - note these down along with your API key and URL which will all be used in part 2 when we set up our Flowise chatflows.
</aside>
<aside> <img src="https://prod-files-secure.s3.us-west-2.amazonaws.com/add94f13-0c11-4513-b858-09cbb60c3da1/4933ab58-861c-499b-bd88-81699334206f/Open_AI.png" alt="https://prod-files-secure.s3.us-west-2.amazonaws.com/add94f13-0c11-4513-b858-09cbb60c3da1/4933ab58-861c-499b-bd88-81699334206f/Open_AI.png" width="40px" /> ——————————————————————————————————————————————
Step 1: Create an OpenAI account
Step 2: Head to the top right corner and click “View API Keys”
Step 3: Create a new secret key and note it down at a safe place for later use in part 2 when we work with Flowise. Do not share with other people!
</aside>
Annnd this is it for part 1 of our crash course! Please note down the following as preperation for part 2.
If you need more support, join my new Discord channel to post your questions and I will answer them within 2 business days!
Join the NOMO CODES Discord Server!
Go to next step >
(Step 2) How to host Flowise easily with Railway and how to setup upsert & query chatflow endpoints