Test your AI model's security without leaving your terminal.
Project description
mindgard cli
Test your AI model's security through CLI.
Usage
Install Mindgard CLI
pip install mindgard
Login
mindgard login
Test a mindgard hosted model
mindgard sandbox mistral
mindgard sandbox cfp_faces
Test your model
mindgard test <name> --url <url> <other settings>
e.g.
mindgard test my-model-name \
--url http://127.0.0.1/infer \ # url to test
--selector '["response"]' \ # JSON selector to match the textual response
--request-template '{"prompt": "[INST] {system_prompt} {prompt} [/INST]"}' \ # how to format the system prompt and prompt in the API request
--system-prompt 'respond with hello' # system prompt to test the model with
Using a Configuration File
You can specify the settings for the mindgard test
command in a TOML configuration file. This allows you to manage your settings in a more structured way and avoid passing them as command-line arguments.
Here's an example of what the configuration file (mymodel.toml
) might look like:
target = "my-model-name"
preset = "e.g huggingface"
url = "http://127.0.0.1/infer"
api_key= "hf_abc"
selector = '["response"]'
request-template = '{"prompt": "[INST] {system_prompt} {prompt} [/INST]"}'
system-prompt = 'respond with hello'
Then run: mindgard test --config mymodel.toml
Using in an ML-Ops pipeline
The exit code of a test will be non-zero if the test identifies risks above your risk threshold. To override the default risk-threshold pass --risk-threshold 50
. This will cause the CLI to exit with an non-zero exit status if any test results in a risk score over 50.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mindgard-0.24.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 160c55c16a09b890b5a8f4d47d940bdb2c1402127f81f4ef77afe1a1a599ce29 |
|
MD5 | 9c7c83f35774739183c8d447bd15ca74 |
|
BLAKE2b-256 | 3da88235caa5f2cae2030a6cf640c276fa0117d339ef4bf109851712b4c04498 |