- Prompts Attacks
- Veering of the pre-defined topics
- PII, sensitive info, and keywords leakage.
- Toxicity
- Etc.
Installation
Using pip:Prerequisites
Generate an API Key:- Navigate to the Settings
- Click on the
+ Create new secret key. - Name the key
Quickstart Key. - Click on the
Addbutton. - Copy the key value by pressing on the copy icon.
Code Usage
Instantiate the pack with the API Key paste your api key into env ZENGUARD_API_KEYDetect Prompt Injection
-
is_detected(boolean): Indicates whether a prompt injection attack was detected in the provided message. In this example, it is False. -
score(float: 0.0 - 1.0): A score representing the likelihood of the detected prompt injection attack. In this example, it is 0.0. -
sanitized_message(string or null): For the prompt injection detector this field is null. -
latency(float or null): Time in milliseconds during which the detection was performed Error Codes: -
401 Unauthorized: API key is missing or invalid. -
400 Bad Request: The request body is malformed. -
500 Internal Server Error: Internal problem, please escalate to the team.
More examples
- Detect PII
- Detect Allowed Topics
- Detect Banned Topics
- Detect Keywords
- Detect Secrets
- Detect Toxicity
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.