docs(huggingface.md): adding huggingface text-embedding-inference to docs

This commit is contained in:
Krrish Dholakia 2023-10-24 17:53:39 -07:00
parent 822b0b55e8
commit 046e1384c3

View file

@ -85,7 +85,7 @@ print(response)
</TabItem>
</Tabs>
## Usage - Streaming
## Streaming
<a target="_blank" href="https://colab.research.google.com/github/BerriAI/litellm/blob/main/cookbook/LiteLLM_HuggingFace.ipynb">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="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)