A Next.js template that uses CloseVector as the database, CloseVector is a vector database that enables vector similarity search, which can run on both browser and server side.
This demo is a rewritten version of postgres-pgvector provided by Vercel.
This demo aims to demonstrate how to use CloseVector in Next.js, and how to use CloseVector to implement a simple search engine. Also, it demonstrates the inserting performance of CloseVector
https://closevector-nextjs-demo.vercel.app/
If you want to use the embedding API provided by CloseVector, as demonstrated in this demo, you need to obtain an access key from CloseVector.
Alternatively, you can implement your own embedding using the OpenAI API by extending the class CloseVectorEmbeddings and passing it to useCloseVectorManager
.
You can choose from one of the following two methods to use this repository:
Execute create-next-app
with pnpm to bootstrap the example:
pnpm create next-app --example https://github.com/MegaPortal/closevector-nextjs-demo
Once that's done, copy the .env.example file in this directory to .env.local (which will be ignored by Git):
cp .env.example .env.local
Then open .env.local
and set the environment variables to match the ones in your Vercel Storage Dashboard.
Next, run Next.js in development mode:
pnpm dev
Deploy it to the cloud with Vercel (Documentation).