Supabase
🚀
Enhanced
Direct integration with Langfuse tracing
Prerequisite
- Register an account for Supabase
- Click New project
 (2) (1).png)
- Input required fields
| Field Name | Description |
|---|---|
| Name | name of the project to be created. (e.g. Flowise) |
| Database Password | password to your postgres database |
 (1) (1).png)
- Click Create new project and wait for the project to finish setting up
- Click SQL Editor
 (2) (2).png)
- Click New query
 (1).png)
- Copy and Paste the below SQL query and run it by
Ctrl + Enteror click RUN. Take note of the table name and function name.
- Table name:
documents - Query name:
match_documents
-- 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;
$$;
If some cases, you might be using Record Manager to keep track of the upserts and prevent duplications. Since Record Manager generates a random UUID for each embeddings, you will have to change the id column entity to text:
-- Enable the pgvector extension to work with embedding vectors
create extension vector;
-- Create a table to store your documents
create table documents (
id text primary key, -- CHANGE TO TEXT
content text,
metadata jsonb,
embedding vector(1536)
);
-- 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 text, -- CHANGE TO TEXT
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;
$$;
 (1) (1) (1) (2).png)
Setup
- Click Project Settings
 (1).png)
- Get your Project URL & API Key
 (3).png)
- Copy and Paste each details (API Key, URL, Table Name, Query Name) into Supabase node
.png)
- Document can be connected with any node under Document Loader category
- Embeddings can be connected with any node under Embeddings category
Filtering
Let’s say you have different documents upserted, each specified with a unique value under the metadata key {source}

You can use metadata filtering to query specific metadata:
UI
 (1) (1) (1) (1) (2) (1).png)
API
"overrideConfig": {
"supabaseMetadataFilter": {
"source": "henry"
}
}