mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
test(utils): cover provider-specific dimension dropping
Signed-off-by: Hasnaat Hussain <hasnaat.hussain.2@gmail.com>
This commit is contained in:
parent
c37cbb7fde
commit
b5bf48331c
1 changed files with 19 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue