Skip to content

ashiqsultan/mongodb-vector-openai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB Vector Search with OpenAI API

Note: Atlas Cluster v7.0 is required for creating Vector Index programmatically. For versions below that,vector indexes can be created directly from the Atlas console.

Project setup

  1. Clone the repo
  2. Create a .env file in the root directory of the project.
touch .env
  1. Create two variables in your .env file: MONGODB_URI and OPENAI_API_KEY.
echo "MONGODB_URI=your_mongodb_uri" >> .env
echo "OPENAI_API_KEY=your_openai_api_key" >> .env
  1. Install node modules.
npm install      # (or) yarn install
  1. Run yarn run dev or npm run dev to start the server.
npm run dev    # (or) yarn run dev

If the MONGODB_URI is correct, it should connect without any error and start the server at port 5000. For the OpenAI API key, you need to create a new account.

About

A simple code base to demonstrate how to use MongoDB Atlas Vector search with OpenAI API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published