| """Minimal example: load the llm-redteam-owasp-prompts dataset.""" | |
| from collections import Counter | |
| from datasets import load_dataset | |
| # Loads data.jsonl from the Hub (split defaults to "train"). | |
| ds = load_dataset("9mark9/llm-redteam-owasp-prompts", split="train") | |
| print(f"Total payloads: {len(ds)}") | |
| print("By category:", dict(Counter(ds["category"]))) | |
| print("By OWASP:", dict(Counter(ds["owasp"]))) | |
| print("By severity:", dict(Counter(ds["severity"]))) | |
| # Inspect one record. | |
| print("\nExample record:") | |
| print(ds[0]) | |
| # Filter to a single attack category for targeted red-team evaluation. | |
| jailbreaks = ds.filter(lambda r: r["category"] == "JAILBREAK") | |
| print(f"\nJailbreak payloads: {len(jailbreaks)}") | |