LiteLLMEmbeddingClient#
dbally.embeddings.LiteLLMEmbeddingClient
#
LiteLLMEmbeddingClient(model: str = 'text-embedding-3-small', options: Optional[Dict] = None, api_base: Optional[str] = None, api_key: Optional[str] = None, api_version: Optional[str] = None)
Bases: EmbeddingClient
Client for creating text embeddings using LiteLLM API.
Constructs the LiteLLMEmbeddingClient.
PARAMETER | DESCRIPTION |
---|---|
model |
Name of the LiteLLM supported model to be used. Default is "text-embedding-3-small".
TYPE:
|
options |
Additional options to pass to the LiteLLM API.
TYPE:
|
api_base |
The API endpoint you want to call the model with.
TYPE:
|
api_key |
API key to be used. API key to be used. If not specified, an environment variable will be used, for more information, follow the instructions for your specific vendor in the LiteLLM documentation.
TYPE:
|
api_version |
The API version for the call.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ImportError
|
If the litellm package is not installed. |
Source code in src/dbally/embeddings/litellm.py
get_embeddings
async
#
Creates embeddings for the given strings.
PARAMETER | DESCRIPTION |
---|---|
data |
List of strings to get embeddings for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[List[float]]
|
List of embeddings for the given strings. |
RAISES | DESCRIPTION |
---|---|
EmbeddingConnectionError
|
If there is a connection error with the embedding API. |
EmbeddingStatusError
|
If the embedding API returns an error status code. |
EmbeddingResponseError
|
If the embedding API response is invalid. |