Pentesting
Run pen test against both ZenGuard AI and (optionally) ChatGPT.
Note that we are always running the pentest against the most up-to-date models, such as:
- ZenGuard AI: latest release
- ChatGPT:
gpt-4-0125-preview
Using zenguard
library
Pentest against ZenGuard AI:
import os
from zenguard import (
Credentials,
Detector,
Endpoint,
ZenGuard,
ZenGuardConfig,
)
if __name__ == "__main__":
api_key = os.environ.get("ZEN_API_KEY")
if not api_key:
raise ValueError("ZEN_API_KEY is not set")
config = ZenGuardConfig(credentials=Credentials(api_key=api_key))
zenguard = ZenGuard(config=config)
zenguard.pentest(endpoint=Endpoint.ZENGUARD, detector=Detector.PROMPT_INJECTION)
Pentest against ZenGuard AI and ChatGPT:
import os
from zenguard import (
Credentials,
Detector,
Endpoint,
SupportedLLMs,
ZenGuard,
ZenGuardConfig,
)
if __name__ == "__main__":
api_key = os.environ.get("ZEN_API_KEY")
openai_api_key = os.environ.get("OPENAI_API_KEY")
if not api_key or not openai_api_key:
raise ValueError("API keys are not set")
config = ZenGuardConfig(credentials=Credentials(api_key=api_key, llm_api_key=opena_api_key), llm=SupporedLLMs.CHATGPT)
zenguard = ZenGuard(config=config)
zenguard.pentest(endpoint=Endpoint.ZENGUARD, detector=Detector.PROMPT_INJECTION)
zenguard.pentest(endpoint=Endpoint.OPENAI, detector=Detector.PROMPT_INJECTION)
Using pentest script
Clone this repo and install requirements.
Run pen test against ZenGuard AI:
Run pentest against both ZenGuard AI and ChatGPT: