mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
(sap) minor improve
This commit is contained in:
parent
6e8c993e08
commit
58bea41d17
3 changed files with 31 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue