From eb28ed1dc6da783dfe73ac066d9da8fd68911427 Mon Sep 17 00:00:00 2001 From: PRABHU KIRAN VANDRANKI <72809214+VANDRANKI@users.noreply.github.com> Date: Tue, 19 May 2026 20:19:16 -0400 Subject: [PATCH] fix(embedding): normalize list encoding_format from model config to first element When `encoding_format` is configured as a list in model litellm_params (e.g. `encoding_format: [float, base64]` to declare supported formats), the list was forwarded verbatim to the upstream embedding API, causing vLLM to reject the request with validation errors. Normalize `encoding_format` to its first element when it arrives as a list, matching the function's `Optional[str]` contract. If the list is empty, treat it as `None` (unset). This affects all providers (hosted_vllm, openai, azure, etc.) uniformly. Fixes #28239 --- litellm/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litellm/main.py b/litellm/main.py index c3d1c2e05b0..660559baf6a 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -4809,6 +4809,8 @@ def embedding( # noqa: PLR0915 mock_response: Optional[List[float]] = kwargs.get("mock_response", None) # type: ignore azure_ad_token_provider = kwargs.get("azure_ad_token_provider", None) aembedding: Optional[bool] = kwargs.get("aembedding", None) + if isinstance(encoding_format, list): + encoding_format = encoding_format[0] if encoding_format else None extra_headers = kwargs.get("extra_headers", None) headers = kwargs.get("headers", None) or extra_headers if headers is None: