From 046e1384c329bdcf8d36c3149df27f2640a3fd45 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 24 Oct 2023 17:53:39 -0700 Subject: [PATCH] docs(huggingface.md): adding huggingface text-embedding-inference to docs --- docs/my-website/docs/providers/huggingface.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/my-website/docs/providers/huggingface.md b/docs/my-website/docs/providers/huggingface.md index 71a6a3dc7b4..fabfcfcbb46 100644 --- a/docs/my-website/docs/providers/huggingface.md +++ b/docs/my-website/docs/providers/huggingface.md @@ -85,7 +85,7 @@ print(response) -## Usage - Streaming +## Streaming Open In Colab @@ -116,6 +116,18 @@ for chunk in response: print(chunk) ``` +## Embedding +LiteLLM supports Huggingface's [text-embedding-inference](https://github.com/huggingface/text-embeddings-inference) format. +```python +from litellm import embedding +import os +os.environ['HUGGINGFACE_API_KEY'] = "" +response = embedding( + model='huggingface/microsoft/codebert-base', + input=["good morning from litellm"] +) +``` + ### [OPTIONAL] API KEYS + API BASE If required, you can set the api key + api base, set it in your os environment. [Code for how it's sent](https://github.com/BerriAI/litellm/blob/0100ab2382a0e720c7978fbf662cc6e6920e7e03/litellm/llms/huggingface_restapi.py#L25)