(sap) minor improve

This commit is contained in:
Vasilisa Parshikova 2026-03-24 12:33:19 +04:00 committed by Sameer Kankute
parent 6e8c993e08
commit 58bea41d17
No known key found for this signature in database
3 changed files with 31 additions and 2 deletions

View file

@ -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

View file

@ -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':

View file

@ -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