Skip to main content

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 !

Metadata

Release files for aiguardrail 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiguardrail 0.1.0
File Size Uploaded Provenance
aiguardrail-0.1.0.tar.gz 6.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiguardrail 0.1.0
File Interpreter ABI Platform
aiguardrail-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / aiguardrail-0.1.0.tar.gz

Download URL aiguardrail-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
30f534d8a6b3ec3dca267cefe9fe5a853664ff864fa16ad5b3f063e9239d89ec
BLAKE2b-256 checksum
How to use checksums
10470e91c75c8db828a1ce10be21aadc1bdd219f3eeafe616e3eb9b8b3bb73ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / aiguardrail-0.1.0-py3-none-any.whl

Download URL aiguardrail-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61849784e89fa3aa128bf89ce2770cb1c76bb98f59ffb3d35ab2724120b59a7a
BLAKE2b-256 checksum
How to use checksums
546c9b96bbf1e024b14a8072c53efe9da5936c782199a72560de9c53a3df7b2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Security for aiguardrail 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page