mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
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
This commit is contained in:
parent
a72414a061
commit
eb28ed1dc6
1 changed files with 2 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue