Sign inSign up

amotzek/text-embeddings

By amotzek

•Updated over 1 year ago

OpenAI-compatible microservice for text embeddings

Image
Machine learning & AI
0

739

amotzek/text-embeddings repository overview

This image contains Ubuntu, Python, CherryPy, IBM Granite-Embedding-278M-Multilingual and an OpenAI-compatible microservice that exposes the embedding model on port 8080.

The use of Ubuntu follows Canonical’s IPRights Policy, see https://ubuntu.com/legal/intellectual-property-policy⁠.

View license information⁠ https://www.debian.org/social_contract#guidelines⁠⁠ for additional software contained in Debian packages.

Python is used under the Python Software Foundation License Version 2, see https://docs.python.org/3/license.html⁠.

CherryPy is distributed under a BSD license, see https://github.com/cherrypy/cherrypy/blob/main/LICENSE.md⁠.

All Granite Embedding Models are distributed under Apache 2.0 license, see https://github.com/ibm-granite/granite-embedding-models/blob/main/LICENSE⁠.

The microservice is distributed under Apache License Version 2.0, see http://www.apache.org/licenses/⁠.

Send a Request
curl http://...:8080/embeddings⁠
-H "Content-Type: application/json"
-H "Authorization: Bearer ..."
-d '{ "input": "That is a nice web service.", "model": "ibm-granite/granite-embedding-278m-multilingual" }'

Response
{
"object": "list",
"data": [{
"object": "embedding",
"index": 0,
"embedding": [...]
}],
"model": "ibm-granite/granite-embedding-278m-multilingual",
"usage": {"prompt_tokens": null, "total_tokens": null}
}

The token needed for authorization can be set via the environment variable API_KEY.

Dockerfile
FROM amotzek/python-3

RUN --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt pip3 install --break-system-packages --requirement /tmp/requirements.txt

RUN --mount=type=bind,source=download_model.py,target=/tmp/download_model.py python3 /tmp/download_model.py

COPY service.py /service.py

EXPOSE 8080

CMD ["python3", "/service.py"]

Tag summary

Content type

Image

Digest

sha256:12213dd08…

Size

7.2 GB

Last updated

over 1 year ago

docker pull amotzek/text-embeddings