pgvector
Postgres extension.
Setup
Setup database instance with Supabase
Refer to the Prisma and Supabase integration guide to setup a new database instance with Supabase and Prisma.Install Prisma
npm
Setup pgvector
self hosted instance with docker-compose
pgvector
provides a prebuilt Docker image that can be used to quickly setup a self-hosted Postgres instance.
Create a new schema
Assuming you haven’t created a schema yet, create a new model with avector
field of type Unsupported("vector")
:
--create-only
to avoid running the migration directly.
npm
pgvector
extension if it hasn’t been enabled yet:
npm
Usage
npm
Table names and column names (in fields such as
tableName
, vectorColumnName
, columns
and filter
) are passed into SQL queries directly without parametrisation.These fields must be sanitized beforehand to avoid SQL injection.equals
, in
, isNull
, isNotNull
, like
, lt
, lte
, gt
, gte
, not
.
The samples above uses the following schema:
namespace
if you don’t need it.
Related
- Vector store conceptual guide
- Vector store how-to guides