This project uses LitServe to serve text embedding models with OpenAI-compatible API. Development and testing are Docker-driven.
Create a production-ready slim image (~4GB instead of ~12GB) using SlimToolkit:
./slim-build.sh
This builds the base image, creates a slimmed version, and tests it automatically.
docker compose build
docker compose up
The server starts immediately in HOT_STANDBY mode. For socket activation (on-demand startup), set SOCKET_ACTIVATE=1.
You can use curl to get embeddings for one or more texts using the OpenAI-compatible API:
curl -X POST "http://localhost:8080/v1/embeddings" \
-H "Content-Type: application/json" \
-d '{
"input": ["Hello world", "Foo Bar"],
"model": "NoInstruct-small-Embedding-v0",
"encoding_format": "float"
}'
The response will be in OpenAI format:
{
"data": [
{"index": 0, "embedding": [...], "object": "embedding"},
{"index": 1, "embedding": [...], "object": "embedding"}
],
"model": "NoInstruct-small-Embedding-v0",
"object": "list",
"usage": {"prompt_tokens": 0, "total_tokens": 0}
}
/v1/embeddings: Generate embeddings for input text(s)/health: Health check endpointTag and push the slim image to your registry:
docker tag embedding-service:slim crunchr/embedding-service:0.3
docker push crunchr/embedding-service:0.3
docker tag embedding-service:slim crunchr/embedding-service:latest
docker push crunchr/embedding-service:latest
Content type
Image
Digest
sha256:8fcbd57a1…
Size
1.1 GB
Last updated
10 months ago
docker pull crunchr/embedding-service