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 846aa43 commit 80c07b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions aisploit/targets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .email import EmailTarget, EmailSender, EmailReceiver, UserPasswordAuth
from .image import ImageTarget
from .image import OpenAIImageTarget
from .langchain import LangchainTarget
from .stdout import StdOutTarget
from .target import WrapperTarget, target
Expand All @@ -9,7 +9,7 @@
"EmailSender",
"EmailReceiver",
"UserPasswordAuth",
"ImageTarget",
"OpenAIImageTarget",
"LangchainTarget",
"StdOutTarget",
"WrapperTarget",
Expand Down
2 changes: 1 addition & 1 deletion aisploit/targets/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ..core import BaseTarget, Response, BasePromptValue


class ImageTarget(BaseTarget):
class OpenAIImageTarget(BaseTarget):
def __init__(
self,
*,
Expand Down
18 changes: 12 additions & 6 deletions examples/target.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,27 @@
"source": [
"from dotenv import load_dotenv\n",
"from langchain_core.prompt_values import StringPromptValue\n",
"from aisploit.targets import EmailTarget, EmailSender, EmailReceiver, UserPasswordAuth, ImageTarget\n",
"from aisploit.targets import (\n",
" EmailTarget,\n",
" EmailSender,\n",
" EmailReceiver,\n",
" UserPasswordAuth,\n",
" OpenAIImageTarget,\n",
")\n",
"\n",
"load_dotenv()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ImagesResponse(created=1713017874, data=[Image(b64_json=None, revised_prompt=None, url='https://oaidalleapiprodscus.blob.core.windows.net/private/org-hQ7KRgz5Vomr6fPJrIUS789k/user-WXtTIx0ozo4TqkMvP9AIJA6F/img-fafNNMlevTN7xp9Ug5tBYfaE.png?st=2024-04-13T13%3A17%3A54Z&se=2024-04-13T15%3A17%3A54Z&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-13T07%3A52%3A32Z&ske=2024-04-14T07%3A52%3A32Z&sks=b&skv=2021-08-06&sig=DddNxDK5NTNRaXKDIjfgFvQ/RHdJpRNM/gwjAL9BWTs%3D')])\n"
"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"
]
},
{
Expand All @@ -42,14 +48,14 @@
"content=''"
]
},
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target = ImageTarget()\n",
"target.send_prompt(StringPromptValue(text=\"Create a photo of bibo the big yellow bird of the sesame street drinking a bottle of wine\"))"
"target = OpenAIImageTarget()\n",
"target.send_prompt(StringPromptValue(text=\"Create a photo of a bomb\"))"
]
},
{
Expand Down

0 comments on commit 80c07b3

Please sign in to comment.