fix - failing_AzureContentSafety tests

This commit is contained in:
Ishaan Jaff 2024-05-11 17:39:06 -07:00
parent 9c4f1ec3e5
commit 7a6df1a0ab

View file

@ -14,7 +14,6 @@ sys.path.insert(
) # Adds the parent directory to the system path
import pytest
import litellm
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
from litellm import Router, mock_completion
from litellm.proxy.utils import ProxyLogging
from litellm.proxy._types import UserAPIKeyAuth
@ -22,11 +21,16 @@ from litellm.caching import DualCache
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_strict_input_filtering_01():
"""
- have a response with a filtered input
- call the pre call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),
@ -54,11 +58,16 @@ async def test_strict_input_filtering_01():
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_strict_input_filtering_02():
"""
- have a response with a filtered input
- call the pre call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),
@ -81,11 +90,16 @@ async def test_strict_input_filtering_02():
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_loose_input_filtering_01():
"""
- have a response with a filtered input
- call the pre call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),
@ -108,11 +122,16 @@ async def test_loose_input_filtering_01():
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_loose_input_filtering_02():
"""
- have a response with a filtered input
- call the pre call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),
@ -135,11 +154,16 @@ async def test_loose_input_filtering_02():
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_strict_output_filtering_01():
"""
- have a response with a filtered output
- call the post call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),
@ -172,11 +196,16 @@ async def test_strict_output_filtering_01():
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_strict_output_filtering_02():
"""
- have a response with a filtered output
- call the post call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),
@ -204,11 +233,16 @@ async def test_strict_output_filtering_02():
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_loose_output_filtering_01():
"""
- have a response with a filtered output
- call the post call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),
@ -236,11 +270,16 @@ async def test_loose_output_filtering_01():
@pytest.mark.asyncio
@pytest.mark.skip(
reason="we need to get azure content safety endpoints to test against"
)
async def test_loose_output_filtering_02():
"""
- have a response with a filtered output
- call the post call hook
"""
from litellm.proxy.hooks.azure_content_safety import _PROXY_AzureContentSafety
azure_content_safety = _PROXY_AzureContentSafety(
endpoint=os.getenv("AZURE_CONTENT_SAFETY_ENDPOINT"),
api_key=os.getenv("AZURE_CONTENT_SAFETY_API_KEY"),