docs(embedding): document encoding_format default and env override

Made-with: Cursor
This commit is contained in:
Sameer Kankute
2026-05-01 16:28:30 +05:30
parent a1f0823393
commit 809b83cfdd
2 changed files with 16 additions and 2 deletions
+12 -1
View File
@@ -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)
## `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).
+4 -1
View File
@@ -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.