mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
docs(huggingface.md): adding huggingface text-embedding-inference to docs
This commit is contained in:
parent
822b0b55e8
commit
046e1384c3
1 changed files with 13 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue