A lightweight embedding microservice for ShopNexus. It exposes a single /embed endpoint that converts text into dense and sparse vectors using BGE-M3.
Accepts a list of strings and returns dense + sparse embeddings for each.
Request:
{
"texts": ["running shoes", "wireless headphones"]
}Response:
{
"embeddings": [
{
"dense": [0.012, -0.034, ...],
"sparse": {"142": 0.85, "1024": 0.42, ...}
},
...
]
}Returns {"status": "healthy"}.
Requires Python 3.13+.
# Install dependencies
uv sync
# Run the server
uv run python main.pyThe server starts on http://localhost:8000.
- Model: BGE-M3 (dense + sparse embeddings)
- Framework: Flask
- Dependencies: FlagEmbedding, PyMilvus Model, Transformers, PyTorch