fix(presidio_pii_masking.py): fix conditional check

This commit is contained in:
Krrish Dholakia 2024-02-13 22:11:03 -08:00
parent f68b656040
commit 6b91f48c64
2 changed files with 3 additions and 3 deletions

View file

@ -154,8 +154,8 @@ class _OPTIONAL_PresidioPIIMasking(CustomLogger):
if litellm.output_parse_pii == False:
return response
if isinstance(response, ModelResponse) and isinstance(
response.choices, StreamingChoices
if isinstance(response, ModelResponse) and not isinstance(
response.choices[0], StreamingChoices
): # /chat/completions requests
if isinstance(response.choices[0].message.content, str):
verbose_proxy_logger.debug(

View file

@ -53,7 +53,7 @@ async def test_output_parsing():
mock_response="Hello <PERSON>! How can I assist you today?",
)
new_response = await pii_masking.async_post_call_success_hook(
user_api_key_dict=UserAPIKeyAuth(), response=response, call_type="completion"
user_api_key_dict=UserAPIKeyAuth(), response=response
)
assert (