mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
fix: drop dimensions in hosted_vllm when drop_params=True and model is not text-embedding-3
- Add dimensions drop logic in HostedVLLMEmbeddingConfig.map_openai_params() - Update test cases to use groq provider per Greptile feedback
This commit is contained in:
parent
9df6e2a1de
commit
a2451ef384
2 changed files with 16 additions and 13 deletions
|
|
@ -163,8 +163,16 @@ class HostedVLLMEmbeddingConfig(BaseEmbeddingConfig):
|
|||
Map OpenAI parameters to Hosted VLLM format.
|
||||
"""
|
||||
for param, value in non_default_params.items():
|
||||
if param in self.get_supported_openai_params(model):
|
||||
optional_params[param] = value
|
||||
if param not in self.get_supported_openai_params(model):
|
||||
continue
|
||||
# Drop dimensions when drop_params=True and model is not text-embedding-3
|
||||
if (
|
||||
param == "dimensions"
|
||||
and drop_params
|
||||
and "text-embedding-3" not in model
|
||||
):
|
||||
continue
|
||||
optional_params[param] = value
|
||||
return optional_params
|
||||
|
||||
def get_error_class(
|
||||
|
|
|
|||
|
|
@ -477,17 +477,12 @@ def test_cohere_embedding_optional_params():
|
|||
@pytest.mark.parametrize(
|
||||
"model,custom_llm_provider,drop_params,expect_dimensions",
|
||||
[
|
||||
# hosted_vllm with a non-text-embedding-3 model and drop_params=True → drop
|
||||
("intfloat/e5-large-v2", "hosted_vllm", True, False),
|
||||
# hosted_vllm with a non-text-embedding-3 model and drop_params=False → keep
|
||||
("intfloat/e5-large-v2", "hosted_vllm", False, True),
|
||||
# text-embedding-3 model should always keep dimensions
|
||||
("text-embedding-3-small", "openai_compatible_providers", True, True),
|
||||
("text-embedding-3-small", "openai_compatible_providers", False, True),
|
||||
# openrouter with a non-text-embedding-3 model and drop_params=True → drop
|
||||
("jina-embeddings-v3", "openai_compatible_providers", True, False),
|
||||
# openrouter without drop_params → keep (don't block providers that support dimensions)
|
||||
("jina-embeddings-v3", "openai_compatible_providers", False, True),
|
||||
("intfloat/e5-large-v2", "groq", True, False), # drop when drop_params=True
|
||||
("intfloat/e5-large-v2", "groq", False, True), # keep when drop_params=False
|
||||
("text-embedding-3-small", "groq", True, True), # text-embedding-3 always kept
|
||||
("text-embedding-3-small", "groq", False, True),
|
||||
("jina-embeddings-v3", "groq", True, False),
|
||||
("jina-embeddings-v3", "groq", False, True),
|
||||
],
|
||||
)
|
||||
def test_openai_compatible_embedding_dimensions_drop_params(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue