Skip to content

Commit

Permalink
Reformat files and add required testing dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheepsta300 committed Oct 8, 2024
1 parent 446e396 commit 02e85f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions libs/community/extended_testing_deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ anthropic>=0.3.11,<0.4
arxiv>=1.4,<2
assemblyai>=0.17.0,<0.18
atlassian-python-api>=3.36.0,<4
azure-ai-contentsafety>=1.0.0
azure-ai-documentintelligence>=1.0.0b1,<2
azure-identity>=1.15.0,<2
azure-search-documents==11.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ def __init__(
input (str): The input given by the user to the model.
"""
self.input = input
self.message = (
f"The input has breached Azure's Content Safety Policy: {self.input}"
)
self.message = ("The input has breached Azure's Content Safety Policy")
super().__init__(self.message)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
AzureHarmfulContentError,
)


@pytest.mark.requires("azure.ai.contentsafety")
def test_content_safety(mocker: Any) -> None:
mocker.patch("azure.ai.contentsafety.ContentSafetyClient", autospec=True)
Expand All @@ -23,6 +24,7 @@ def test_content_safety(mocker: Any) -> None:
assert chain.content_safety_key == key
assert chain.content_safety_endpoint == endpoint


@pytest.mark.requires("azure.ai.contentsafety")
def test_raise_error_when_harmful_content_detected(mocker: Any) -> None:
key = "key"
Expand All @@ -45,6 +47,7 @@ def test_raise_error_when_harmful_content_detected(mocker: Any) -> None:
with pytest.raises(AzureHarmfulContentError):
chain._call({chain.input_key: text})


@pytest.mark.requires("azure.ai.contentsafety")
def test_no_harmful_content_detected(mocker: Any) -> None:
key = "key"
Expand Down

0 comments on commit 02e85f5

Please sign in to comment.