test_pre_process_non_default_params (#13990)

This commit is contained in:
Ishaan Jaff 2025-08-26 19:15:17 -07:00 • committed by GitHub
parent 6696955506
commit ab7efaa832
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View file

@ -1256,6 +1256,7 @@ def completion( # type: ignore # noqa: PLR0915
additional_drop_params=kwargs.get("additional_drop_params"),
remove_sensitive_keys=True,
add_provider_specific_params=True,
provider_config=provider_config,
)
if litellm.add_function_to_prompt and optional_params.get(

View file

@ -3088,6 +3088,7 @@ def pre_process_non_default_params(
model: str,
remove_sensitive_keys: bool = False,
add_provider_specific_params: bool = False,
provider_config: Optional[BaseConfig] = None,
) -> dict:
"""
Pre-process non-default params to a standardized format
@ -3103,14 +3104,6 @@ def pre_process_non_default_params(
additional_endpoint_specific_params=["messages"],
)
provider_config: Optional[BaseConfig] = None
if custom_llm_provider is not None and custom_llm_provider in [
provider.value for provider in LlmProviders
]:
provider_config = ProviderConfigManager.get_provider_chat_config(
model=model, provider=LlmProviders(custom_llm_provider)
)
if "response_format" in non_default_params:
if provider_config is not None:
non_default_params[

View file

@ -957,7 +957,12 @@ def test_get_model_info_shows_supports_computer_use():
def test_pre_process_non_default_params(model, custom_llm_provider):
from pydantic import BaseModel
from litellm.utils import pre_process_non_default_params
from litellm.utils import ProviderConfigManager, pre_process_non_default_params
provider_config = ProviderConfigManager.get_provider_chat_config(
model=model,
provider=LlmProviders(custom_llm_provider)
)
class ResponseFormat(BaseModel):
x: str
@ -974,6 +979,7 @@ def test_pre_process_non_default_params(model, custom_llm_provider):
special_params=special_params,
custom_llm_provider=custom_llm_provider,
additional_drop_params=None,
provider_config=provider_config,
)
print(processed_non_default_params)
assert processed_non_default_params == {