test(utils): cover provider-specific dimension dropping

Signed-off-by: Hasnaat Hussain <hasnaat.hussain.2@gmail.com>
This commit is contained in:
Hasnaat Hussain 2026-08-12 23:12:04 +05:00
parent c37cbb7fde
commit b5bf48331c

View file

@ -165,11 +165,8 @@ def test_openai_non_text_embedding_3_drop_params_global():
def test_azure_and_openai_compatible_drop_params():
"""
Verify that dimensions parameter is correctly dropped on Azure and OpenAI compatible calls
when drop_params is True (either per-call or globally), and raises UnsupportedParamsError
otherwise.
when drop_params is True (either per-call or globally), while preserving it otherwise.
"""
from litellm.exceptions import UnsupportedParamsError
prev_drop_params = litellm.drop_params
# 1. Test Azure drop_params=True (per-call)
@ -239,3 +236,21 @@ def test_azure_and_openai_compatible_drop_params():
litellm.drop_params = prev_drop_params
@pytest.mark.parametrize("provider", ["nvidia_nim", "lm_studio", "fireworks_ai"])
def test_dedicated_openai_compatible_providers_drop_dimensions(provider):
"""Keep dedicated provider mappings reachable when dimensions is dropped."""
prev_drop_params = litellm.drop_params
litellm.drop_params = False
try:
model, custom_llm_provider, _, _ = get_llm_provider(
model=f"{provider}/dummy-model"
)
optional_params = get_optional_params_embeddings(
model=model,
dimensions=512,
custom_llm_provider=custom_llm_provider,
drop_params=True,
)
assert "dimensions" not in optional_params
finally:
litellm.drop_params = prev_drop_params