Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hupe1980 committed Apr 14, 2024
1 parent 792c94a commit ce7c37e
Show file tree
Hide file tree
Showing 25 changed files with 15 additions and 15 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
File renamed without changes.
2 changes: 1 addition & 1 deletion aisploit/scanner/plugins/many_shot_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions aisploit/scanner/plugins/prompt_injection_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion aisploit/sender/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Callbacks,
CallbackManager,
)
from ..converter import NoOpConverter
from ..converters import NoOpConverter
from .report import SendReport, SendReportEntry


Expand Down
4 changes: 2 additions & 2 deletions examples/classifier.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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()"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/converter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion examples/sender.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/target.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -60,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down
2 changes: 1 addition & 1 deletion tests/classifier/test_text.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re
import pytest
from aisploit.classifier import RegexClassifier, SubstringClassifier
from aisploit.classifiers import RegexClassifier, SubstringClassifier


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/converter/test_base64.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
2 changes: 1 addition & 1 deletion tests/converter/test_join.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
2 changes: 1 addition & 1 deletion tests/converter/test_keyboard_typo.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down

0 comments on commit ce7c37e

Please sign in to comment.