Supabase is an open-source Firebase alternative.Supabase
is built on top ofPostgreSQL
, which offers strong SQL querying capabilities and enables a simple interface with already-existing tools and frameworks.
PostgreSQL also known as Postgres
, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance.
This notebook shows how to use Supabase
and pgvector
as your VectorStore.
You’ll need to install langchain-community
with pip install -qU langchain-community
to use this integration
To run this notebook, please ensure:
- the
pgvector
extension is enabled - you have installed the
supabase-py
package - that you have created a
match_documents
function in your database - that you have a
documents
table in yourpublic
schema similar to the one below.
OpenAIEmbeddings
so we have to get the OpenAI API Key.
SupabaseVectorStore
directly:
Similarity search with score
The returned distance score is cosine distance. Therefore, a lower score is better.Retriever options
This section goes over different options for how to use SupabaseVectorStore as a retriever.Maximal Marginal Relevance Searches
In addition to using similarity search in the retriever object, you can also usemmr
.