HUB
Sign inSign up

crunchr/embedding-service

By crunchr

•Updated 6 months ago

Lit serve based embedding service

Image
0

10K+

crunchr/embedding-service repository overview

⁠Serve

This project uses LitServe to serve text embedding models with OpenAI-compatible API. Development and testing are Docker-driven.

⁠Getting Started

⁠Build Optimized Image with SlimToolkit

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.

⁠Manual Build
docker compose build
⁠Run Container
docker compose up

The server starts immediately in HOT_STANDBY mode. For socket activation (on-demand startup), set SOCKET_ACTIVATE=1.

⁠Using the Embeddings

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}
}
⁠API Endpoints
  • POST /v1/embeddings: Generate embeddings for input text(s)
  • GET /health: Health check endpoint

⁠Publishing to Registry

Tag 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

Tag summary

Content type

Image

Digest

sha256:8fcbd57a1…

Size

1.1 GB

Last updated

10 months ago

docker pull crunchr/embedding-service