diff --git a/litellm/llms/sap/chat/models.py b/litellm/llms/sap/chat/models.py index c5a430786ef..d5b37473745 100644 --- a/litellm/llms/sap/chat/models.py +++ b/litellm/llms/sap/chat/models.py @@ -402,7 +402,7 @@ class MaskingModuleConfig(BaseModel): "The 'masking_providers' parameter is deprecated and will be removed on Sept 15, 2026. " "Use 'providers' instead.", DeprecationWarning, - stacklevel=2, + stacklevel=5, ) return self diff --git a/tests/test_litellm/llms/sap/chat/test_sap_transformation.py b/tests/test_litellm/llms/sap/chat/test_sap_transformation.py index 24062271be4..9bb62e95541 100644 --- a/tests/test_litellm/llms/sap/chat/test_sap_transformation.py +++ b/tests/test_litellm/llms/sap/chat/test_sap_transformation.py @@ -1,3 +1,4 @@ +import warnings import pytest from pydantic import ValidationError @@ -449,6 +450,34 @@ class TestSAPTransformationIntegration: assert "must set exactly one of: 'providers' or 'masking_providers'" in str(exc_info.value) + def test_masking_providers_deprecated_emits_warning(self, mock_config): + masking_config = { + 'masking_providers': + [ + { + 'type': 'sap_data_privacy_integration', + 'method': 'anonymization', + 'entities': [ + {'type': 'profile-address'} + ] + } + ] + } + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + mock_config.transform_request( + model="gpt-4o", + messages=[{"role": "user", "content": "Hi"}], + optional_params={"masking": masking_config}, + litellm_params={}, + headers={}, + ) + assert any( + issubclass(warning.category, DeprecationWarning) + and "masking_providers" in str(warning.message) + for warning in w + ), "Expected DeprecationWarning for 'masking_providers'" + def test_sap_translation(self, mock_config): translation_config = { 'input': diff --git a/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py b/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py index 7bf194b6ad9..2d4be6f33c7 100644 --- a/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py +++ b/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py @@ -6,7 +6,7 @@ from litellm.llms.sap.embed.transformation import GenAIHubEmbeddingConfig @pytest.fixture def fake_token_creator(): - return lambda: "Bearer FAKE_TOKEN", "https://api.ai.moke-sap.com", "fake-group" + return (lambda: "Bearer FAKE_TOKEN", "https://api.ai.moke-sap.com", "fake-group") @pytest.fixture