How to Test Prompt Injections with PromptMixer

January 29, 2024

Testing your AI systems against malicious prompt injections is an important part of responsible AI development. PromptMixer provides some useful tools to help with testing prompt injections.

Step One

If you want to test your API or model, you'll need to create a connector for it within PromptMixer. If you just want to use the "system prompt," simply select the model itself and add the system prompt as a property of the connector.

Step Two

Open up the template collection in PromptMixer and select the collection containing different prompt injection examples. Download this collection to have a baseline set of injections to test against.

Step Three

After setting up your connector and adding your system prompt, you can run all the prompt chains from the injection collection you downloaded.

You can also configure settings like running a particular injection daily at a specified time for ongoing testing.

Step Four

You'll want to review the responses from the injections manually or use regular expressions to filter for concerning responses.

Step Five

Keep iterating and expanding your prompt injection test set until your system can withstand and detect a wide range of injections without allowing malicious actors to access or control your models.