pgvector
extension, Neon provides a vector store that can be used with LangChain.js to store and query embeddings.
Setup
Select a Neon project
If you do not have a Neon account, sign up for one at Neon. After logging into the Neon Console, proceed to the Projects section and select an existing project or create a new one. Your Neon project comes with a ready-to-use Postgres database namedneondb
that you can use to store embeddings. Navigate to
the Connection Details section to find your database connection string. It should look similar to this:
Application code
To work with Neon Postgres, you need to install the@neondatabase/serverless
package which provides a JavaScript/TypeScript
driver to connect to the database.
npm
npm
NeonPostgres
vectorstore, you need to provide your Neon database connection string. You can use the connection string
we fetched above directly, or store it as an environment variable and use it in your code.
Usage
Related
- Vector store conceptual guide
- Vector store how-to guides