@vercel/postgres
package to use generic Postgres databases
as vector stores, provided they support the pgvector
Postgres extension.
This integration is particularly useful from web environments like Edge functions.
Setup
To work with Vercel Postgres, you need to install the@vercel/postgres
package:
npm
npm
process.env.POSTGRES_URL
.
You can also pass a connection string manually like this:
Connecting to Vercel Postgres
A simple way to get started is to create a serverless Vercel Postgres instance. If you’re deploying to a Vercel project with an associated Vercel Postgres instance, the requiredPOSTGRES_URL
environment variable
will already be populated in hosted environments.
Connecting to other databases
If you prefer to host your own Postgres instance, you can use a similar flow to LangChain’s PGVector vectorstore integration and set the connection string either as an environment variable or as shown above.Usage
Related
- Vector store conceptual guide
- Vector store how-to guides