diff --git a/litellm/llms/hosted_vllm/embedding/README.md b/litellm/llms/hosted_vllm/embedding/README.md index f82b3c77a6..2c58e16fc2 100644 --- a/litellm/llms/hosted_vllm/embedding/README.md +++ b/litellm/llms/hosted_vllm/embedding/README.md @@ -2,4 +2,15 @@ No transformation is required for hosted_vllm embedding. VLLM is a superset of OpenAI's `embedding` endpoint. -To pass provider-specific parameters, see [this](https://docs.litellm.ai/docs/completion/provider_specific_params) \ No newline at end of file +## `encoding_format` + +For OpenAI-compatible embedding calls (including `openai/...` with a custom `api_base` pointing at vLLM), LiteLLM resolves `encoding_format` when it is not set on the request: + +1. Explicit value on the embedding call (`encoding_format=...`). +2. Model config (`litellm_params.encoding_format` on the proxy `model_list` entry). +3. Environment variable `LITELLM_DEFAULT_EMBEDDING_ENCODING_FORMAT` (e.g. in `.env` or container env). +4. Default **`float`**. + +That avoids forwarding `encoding_format=None` to the provider/SDK where some servers behave poorly. + +To pass provider-specific parameters, see [provider-specific params](https://docs.litellm.ai/docs/completion/provider_specific_params). \ No newline at end of file diff --git a/litellm/main.py b/litellm/main.py index 8cff8c0b9a..9d38575474 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -4700,7 +4700,10 @@ def embedding( # noqa: PLR0915 Parameters: - model: The embedding model to use. - input: The input for which embeddings are to be generated. - - encoding_format: Optional[str] The format to return the embeddings in. Can be either `float` or `base64` + - encoding_format: Optional[str] The format to return the embeddings in. Can be either `float` or `base64`. + For OpenAI-compatible embedding routing (`openai`, custom base URL, etc.), when omitted LiteLLM resolves: + explicit argument → mapped optional params (e.g. proxy `litellm_params`) → environment variable + `LITELLM_DEFAULT_EMBEDDING_ENCODING_FORMAT` → default `"float"`. - dimensions: The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models. - timeout: The timeout value for the API call, default 10 mins - litellm_call_id: The call ID for litellm logging.