Skip to content

Commit 82baf37

Browse files
author
Baur
authored
Update zenguard_library.ipynb
1 parent fdfd6ec commit 82baf37

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

docs/colabs/zenguard_library.ipynb

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"id": "detect-injection"
149149
},
150150
"source": [
151-
"### Detect Prompt Injection"
151+
"## Detect Prompt Injection"
152152
]
153153
},
154154
{
@@ -184,11 +184,37 @@
184184
"* `500 Internal Server Error`: Internal problem, please escalate to the team."
185185
]
186186
},
187+
{
188+
"cell_type": "markdown",
189+
"metadata": {
190+
"id": "detect-pii"
191+
},
192+
"source": [
193+
"## Detect PII"
194+
]
195+
},
196+
{
197+
"cell_type": "code",
198+
"metadata": {
199+
"id": "pii-detection"
200+
},
201+
"source": [
202+
"messages = [\"My credit card number is 1234-5679-1234-1234 and my name is John Smith.\"]\n",
203+
"response = zenguard.detect(detectors=[Detector.PII], prompt=message)\n",
204+
"if response.get(\"responses\")[0].get(\"common_response\").get(\"is_detected\") is True:\n",
205+
" pprint(\"PII detected. ZenGuard: 1, big brother: 0.\")\n",
206+
"else:\n",
207+
" pprint(\"No PII detected: your data is safe to feed into any LLM.\")\n",
208+
"pprint(response)"
209+
],
210+
"execution_count": null,
211+
"outputs": []
212+
},
187213
{
188214
"cell_type": "markdown",
189215
"metadata": {},
190216
"source": [
191-
"### More examples\n",
217+
"## More examples\n",
192218
"\n",
193219
" * [Detect PII](https://docs.zenguard.ai/detectors/pii/)\n",
194220
" * [Detect Allowed Topics](https://docs.zenguard.ai/detectors/allowed-topics/)\n",

0 commit comments

Comments
 (0)