examples/mongovector-vectorstore-example/README.md
This project illustrates how to leverage MongoDB as a vector store for performing similarity searches, utilizing OpenAI embeddings within a Go application. It integrates the LangChainGo library, OpenAI's API, and MongoDB to create an efficient vector database for semantic search.
For more information on getting started with MongoDB Atlas, visit the MongoDB Atlas Getting Started Guide. You can also use the following Docker image to containerize a free (M0) tier: MongoDB Atlas Local.
MongoDB Setup:
OpenAI Embeddings Initialization:
Creating the Vector Store:
Inserting Sample Data:
Executing Similarity Searches:
Configure your environment by setting the MongoDB URI and OpenAI API key:
export MONGODB_URI=<your_mongodb_uri>
export OPENAI_API_KEY=<your_openai_api_key>
If you want to run this using docker-compose.yml, MONGODB_URI should be mongodb://localhost:27017/?directConnection=true: docker-compose up -d
Run the program: go run mongovector_vectorstore_example.go