Guardrails for evaluating AI-generated content
Project description
AIGuardrail: AI Content Guardrails
AIGuardrail is a comprehensive Python library designed to evaluate and safeguard AI-generated content. It provides robust checks for safety, factual consistency, readability, privacy, token efficiency, and protection against malicious content.
🚀 Features
- Output Moderation: Detect toxic, offensive, or inappropriate language.
- Factual Consistency & Hallucination Detection: Prevent AI-generated inaccuracies or hallucinated information.
- PII Redaction: Identify and flag personally identifiable information (PII).
- Prompt Injection Protection: Detect potential prompt injection attacks.
- Token Management: Optimize content length based on token limits.
- Response Quality Checks: Evaluate readability, verbosity, and bias in AI outputs.
📦 Installation
Install aiguardrail via pip:
pip install aiguardrail
🛠️ Usage
Evaluate text quickly against all available guardrails:
from aiguardrail.guardrails import evaluate_guardrails
text = "According to the source, this event took place in March."
results_df, final_score = evaluate_guardrails(text)
print(results_df)
print(f"Overall Guardrail Score: {final_score}")
Evaluate specific guardrails only:
specific_guardrails = ["GR-S-001", "GR-Q-005", "GR-C-002"]
results_df, final_score = evaluate_guardrails(text, selected_guardrail_ids=specific_guardrails)
print(results_df)
print(f"Overall Guardrail Score: {final_score}")
📚 Available Guardrails
Retrieve metadata about all guardrails easily:
from aiguardrail.guardrails import list_available_guardrails
guardrails = list_available_guardrails()
for gr in guardrails:
print(f"{gr['id']} - {gr['name']} [{gr['area']}]")
Example output:
GR-S-001 - Output Moderation [Security]
GR-Q-001 - Hallucination Detection [Quality]
GR-S-005 - PII Redaction [Security]
...
📜 License
Guardrails-Eval is licensed under the MIT License. See LICENSE for details.
💻 Author
SHUBHAM GANESH MHASKE
Email: mhaskeshubham1200@gmail.com
⭐ Enjoy using aiguardrail !
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiguardrail-0.1.0.tar.gz.
File metadata
- Download URL: aiguardrail-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30f534d8a6b3ec3dca267cefe9fe5a853664ff864fa16ad5b3f063e9239d89ec
|
|
| MD5 |
0ad8c12420636b140e8b2a952e698665
|
|
| BLAKE2b-256 |
10470e91c75c8db828a1ce10be21aadc1bdd219f3eeafe616e3eb9b8b3bb73ba
|
File details
Details for the file aiguardrail-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aiguardrail-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61849784e89fa3aa128bf89ce2770cb1c76bb98f59ffb3d35ab2724120b59a7a
|
|
| MD5 |
1b6d87bf6394d6b2b2fa2bd518724bf9
|
|
| BLAKE2b-256 |
546c9b96bbf1e024b14a8072c53efe9da5936c782199a72560de9c53a3df7b2b
|