This repo was created during the livestream we had th the official MongoDB YouTube channel.
We demo the usage of Storecraft with Mongo Vector Search
What we did:
- We created an extension for Storecraft, that adds semantic/ai search for products catalog.
- We implemented a small frontend react application to demonstrate the vector search.
First, make sure you have the following environment variables
//.env
OPENAI="YOUR OPENAI KEY"
MONGODB_URL="YOUR MONGODB CONNECTION URL"
Then,
npm install
npm run migrate
npm start
- in Atlas dashboard, create a vector index (call it
vector_index
) forproducts
collection:
{
"fields": [
{
"numDimensions": 1536,
"path": "embedding",
"similarity": "cosine",
"type": "vector"
}
]
}
Now,
- Open dashboard at
http://localhost:8080/api/dashboard
- Upsert some products so every upserted product will be indexed for semantic search by it's title and description.
And then, follow the instructions in the ./frontend
folder to start the web app.