forked from phoenix/litellm-mirror
docs(supported_embeddings.md): add vertex ai embeddings to docs
This commit is contained in:
parent
ea1e0f5ad9
commit
468995b288
1 changed files with 77 additions and 1 deletions
|
@ -1,3 +1,6 @@
|
|||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Embedding Models
|
||||
|
||||
## Quick Start
|
||||
|
@ -7,8 +10,81 @@ import os
|
|||
os.environ['OPENAI_API_KEY'] = ""
|
||||
response = embedding(model='text-embedding-ada-002', input=["good morning from litellm"])
|
||||
```
|
||||
## Proxy Usage
|
||||
|
||||
### Input Params for `litellm.embedding()`
|
||||
**NOTE**
|
||||
For `vertex_ai`,
|
||||
```bash
|
||||
export GOOGLE_APPLICATION_CREDENTIALS="absolute/path/to/service_account.json"
|
||||
```
|
||||
|
||||
### Add model to config
|
||||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: textembedding-gecko
|
||||
litellm_params:
|
||||
model: vertex_ai/textembedding-gecko
|
||||
|
||||
general_settings:
|
||||
master_key: sk-1234
|
||||
```
|
||||
|
||||
### Start proxy
|
||||
|
||||
```bash
|
||||
litellm --config /path/to/config.yaml
|
||||
|
||||
# RUNNING on http://0.0.0.0:8000
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="curl" label="Curl">
|
||||
|
||||
```bash
|
||||
curl --location 'http://0.0.0.0:8000/embeddings' \
|
||||
--header 'Authorization: Bearer sk-1234' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{"input": ["Academia.edu uses"], "model": "textembedding-gecko", "encoding_format": "base64"}'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="openai" label="OpenAI (python)">
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
client = OpenAI(
|
||||
api_key="sk-1234",
|
||||
base_url="http://0.0.0.0:8000"
|
||||
)
|
||||
|
||||
client.embeddings.create(
|
||||
model="textembedding-gecko",
|
||||
input="The food was delicious and the waiter...",
|
||||
encoding_format="float"
|
||||
)
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="langchain" label="Langchain Embeddings">
|
||||
|
||||
```python
|
||||
from langchain_openai import OpenAIEmbeddings
|
||||
|
||||
embeddings = OpenAIEmbeddings(model="textembedding-gecko", openai_api_base="http://0.0.0.0:8000", openai_api_key="sk-1234")
|
||||
|
||||
text = "This is a test document."
|
||||
|
||||
query_result = embeddings.embed_query(text)
|
||||
|
||||
print(f"VERTEX AI EMBEDDINGS")
|
||||
print(query_result[:5])
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Input Params for `litellm.embedding()`
|
||||
### Required Fields
|
||||
|
||||
- `model`: *string* - ID of the model to use. `model='text-embedding-ada-002'`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue