diff --git a/aisploit/classifier/__init__.py b/aisploit/classifiers/__init__.py similarity index 100% rename from aisploit/classifier/__init__.py rename to aisploit/classifiers/__init__.py diff --git a/aisploit/classifier/huggingface/__init__.py b/aisploit/classifiers/huggingface/__init__.py similarity index 100% rename from aisploit/classifier/huggingface/__init__.py rename to aisploit/classifiers/huggingface/__init__.py diff --git a/aisploit/classifier/huggingface/pipeline_prompt_injection_identifier.py b/aisploit/classifiers/huggingface/pipeline_prompt_injection_identifier.py similarity index 100% rename from aisploit/classifier/huggingface/pipeline_prompt_injection_identifier.py rename to aisploit/classifiers/huggingface/pipeline_prompt_injection_identifier.py diff --git a/aisploit/classifier/openai/__init__.py b/aisploit/classifiers/openai/__init__.py similarity index 100% rename from aisploit/classifier/openai/__init__.py rename to aisploit/classifiers/openai/__init__.py diff --git a/aisploit/classifier/openai/moderation.py b/aisploit/classifiers/openai/moderation.py similarity index 100% rename from aisploit/classifier/openai/moderation.py rename to aisploit/classifiers/openai/moderation.py diff --git a/aisploit/classifier/text.py b/aisploit/classifiers/text.py similarity index 100% rename from aisploit/classifier/text.py rename to aisploit/classifiers/text.py diff --git a/aisploit/converter/__init__.py b/aisploit/converters/__init__.py similarity index 100% rename from aisploit/converter/__init__.py rename to aisploit/converters/__init__.py diff --git a/aisploit/converter/base64.py b/aisploit/converters/base64.py similarity index 100% rename from aisploit/converter/base64.py rename to aisploit/converters/base64.py diff --git a/aisploit/converter/gender.py b/aisploit/converters/gender.py similarity index 100% rename from aisploit/converter/gender.py rename to aisploit/converters/gender.py diff --git a/aisploit/converter/join.py b/aisploit/converters/join.py similarity index 100% rename from aisploit/converter/join.py rename to aisploit/converters/join.py diff --git a/aisploit/converter/keyboard_typo.py b/aisploit/converters/keyboard_typo.py similarity index 100% rename from aisploit/converter/keyboard_typo.py rename to aisploit/converters/keyboard_typo.py diff --git a/aisploit/converter/no_op.py b/aisploit/converters/no_op.py similarity index 100% rename from aisploit/converter/no_op.py rename to aisploit/converters/no_op.py diff --git a/aisploit/converter/remove_punctuation.py b/aisploit/converters/remove_punctuation.py similarity index 74% rename from aisploit/converter/remove_punctuation.py rename to aisploit/converters/remove_punctuation.py index 761f268..0365eb1 100644 --- a/aisploit/converter/remove_punctuation.py +++ b/aisploit/converters/remove_punctuation.py @@ -4,5 +4,5 @@ class RemovePunctuationConverter(BaseConverter): def _convert(self, prompt: str) -> str: - translator = str.maketrans('', '', string.punctuation) + translator = str.maketrans("", "", string.punctuation) return prompt.translate(translator) diff --git a/aisploit/converter/sequence.py b/aisploit/converters/sequence.py similarity index 100% rename from aisploit/converter/sequence.py rename to aisploit/converters/sequence.py diff --git a/aisploit/scanner/plugins/many_shot_plugin.py b/aisploit/scanner/plugins/many_shot_plugin.py index b8c19a0..7c9e120 100644 --- a/aisploit/scanner/plugins/many_shot_plugin.py +++ b/aisploit/scanner/plugins/many_shot_plugin.py @@ -4,7 +4,7 @@ from ...core import BaseTarget, BaseConverter, BaseTextClassifier from ...sender import SenderJob -from ...converter import NoOpConverter +from ...converters import NoOpConverter from ...datasets import SampleDataset from ..plugin import Plugin from ..report import Issue, IssueCategory diff --git a/aisploit/scanner/plugins/prompt_injection_plugin.py b/aisploit/scanner/plugins/prompt_injection_plugin.py index 7bca6b9..d55a276 100644 --- a/aisploit/scanner/plugins/prompt_injection_plugin.py +++ b/aisploit/scanner/plugins/prompt_injection_plugin.py @@ -3,9 +3,9 @@ from ...core import BaseTarget, BaseConverter from ...datasets import JailbreakPromptDataset -from ...classifier import SubstringClassifier +from ...classifiers import SubstringClassifier from ...sender import SenderJob -from ...converter import NoOpConverter +from ...converters import NoOpConverter from ..plugin import Plugin from ..report import Issue, IssueCategory diff --git a/aisploit/sender/job.py b/aisploit/sender/job.py index 1d3250e..81f93ad 100644 --- a/aisploit/sender/job.py +++ b/aisploit/sender/job.py @@ -10,7 +10,7 @@ Callbacks, CallbackManager, ) -from ..converter import NoOpConverter +from ..converters import NoOpConverter from .report import SendReport, SendReportEntry diff --git a/examples/classifier.ipynb b/examples/classifier.ipynb index 772db7b..1f4fbf5 100644 --- a/examples/classifier.ipynb +++ b/examples/classifier.ipynb @@ -26,8 +26,8 @@ "source": [ "import textwrap\n", "from dotenv import load_dotenv\n", - "from aisploit.classifier.huggingface import PipelinePromptInjectionIdentifier\n", - "from aisploit.classifier.openai import ModerationClassifier\n", + "from aisploit.classifiers.huggingface import PipelinePromptInjectionIdentifier\n", + "from aisploit.classifiers.openai import ModerationClassifier\n", "\n", "load_dotenv()" ] diff --git a/examples/converter.ipynb b/examples/converter.ipynb index 091134e..92aa1b8 100644 --- a/examples/converter.ipynb +++ b/examples/converter.ipynb @@ -28,7 +28,7 @@ "import os\n", "import textwrap\n", "from dotenv import load_dotenv\n", - "from aisploit.converter import (\n", + "from aisploit.converters import (\n", " Base64Converter,\n", " KeyboardTypoConverter,\n", " JoinConverter,\n", diff --git a/examples/sender.ipynb b/examples/sender.ipynb index 372d22c..30dd3e4 100644 --- a/examples/sender.ipynb +++ b/examples/sender.ipynb @@ -8,7 +8,7 @@ "source": [ "from aisploit.sender import SenderJob\n", "from aisploit.targets import StdOutTarget\n", - "from aisploit.converter import Base64Converter, JoinConverter, KeyboardTypoConverter" + "from aisploit.converters import Base64Converter, JoinConverter, KeyboardTypoConverter" ] }, { diff --git a/examples/target.ipynb b/examples/target.ipynb index 3f38f34..7d465c7 100644 --- a/examples/target.ipynb +++ b/examples/target.ipynb @@ -39,7 +39,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "ImagesResponse(created=1713102814, data=[Image(b64_json=None, revised_prompt=None, url='https://oaidalleapiprodscus.blob.core.windows.net/private/org-hQ7KRgz5Vomr6fPJrIUS789k/user-WXtTIx0ozo4TqkMvP9AIJA6F/img-v0UWWmedcePkBkvsMFbzoqzh.png?st=2024-04-14T12%3A53%3A34Z&se=2024-04-14T14%3A53%3A34Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-04-14T08%3A11%3A05Z&ske=2024-04-15T08%3A11%3A05Z&sks=b&skv=2021-08-06&sig=hH%2BZ7%2BsysK8Ia8MVQAZtvLz94kqGV0AkZ7LMmoirEfs%3D')])\n" + "ImagesResponse(created=1713104041, data=[Image(b64_json=None, revised_prompt=None, url='https://oaidalleapiprodscus.blob.core.windows.net/private/org-hQ7KRgz5Vomr6fPJrIUS789k/user-WXtTIx0ozo4TqkMvP9AIJA6F/img-vAyzvA8irq1RU7dgUQAVuhuS.png?st=2024-04-14T13%3A14%3A01Z&se=2024-04-14T15%3A14%3A01Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-04-14T08%3A00%3A32Z&ske=2024-04-15T08%3A00%3A32Z&sks=b&skv=2021-08-06&sig=K0B4TXwMOxGwIGsTL5P6RrVw97aPG6h5HQt27%2BxQ19I%3D')])\n" ] }, { @@ -60,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ diff --git a/tests/classifier/test_text.py b/tests/classifier/test_text.py index 0af50fb..e818969 100644 --- a/tests/classifier/test_text.py +++ b/tests/classifier/test_text.py @@ -1,6 +1,6 @@ import re import pytest -from aisploit.classifier import RegexClassifier, SubstringClassifier +from aisploit.classifiers import RegexClassifier, SubstringClassifier @pytest.fixture diff --git a/tests/converter/test_base64.py b/tests/converter/test_base64.py index 8ebf725..2b1d5fd 100644 --- a/tests/converter/test_base64.py +++ b/tests/converter/test_base64.py @@ -1,6 +1,6 @@ import base64 from langchain_core.prompt_values import StringPromptValue -from aisploit.converter import Base64Converter +from aisploit.converters import Base64Converter def test_convert_single_prompt(): diff --git a/tests/converter/test_join.py b/tests/converter/test_join.py index 82d224d..2557072 100644 --- a/tests/converter/test_join.py +++ b/tests/converter/test_join.py @@ -1,5 +1,5 @@ from langchain_core.prompt_values import StringPromptValue -from aisploit.converter import JoinConverter +from aisploit.converters import JoinConverter def test_join_with_default_value(): diff --git a/tests/converter/test_keyboard_typo.py b/tests/converter/test_keyboard_typo.py index 1289e00..a9091b5 100644 --- a/tests/converter/test_keyboard_typo.py +++ b/tests/converter/test_keyboard_typo.py @@ -1,6 +1,6 @@ import random from langchain_core.prompt_values import StringPromptValue -from aisploit.converter import KeyboardTypoConverter +from aisploit.converters import KeyboardTypoConverter def test_convert_no_typo():