Metadata-Version: 2.4
Name: llm-guardrails-maintained
Version: 0.3.17
Summary: LLM Guard Rails - An actively maintained security toolkit for Large Language Model interactions. Features advanced sanitization, harmful language detection, data leakage prevention, and prompt injection resistance with continuous improvements and enhancements.
Author-email: Nikhil Singh Bora <nikhilsinghbora17@gmail.com>, "Protect AI (Original)" <community@protectai.com>
License: The MIT License (MIT)
        
        Copyright (c) Protect AI. All rights reserved.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: homepage, https://github.com/Nikhilsinghbora/llm-guardrails
Project-URL: documentation, https://github.com/Nikhilsinghbora/llm-guardrails/blob/main/README.md
Project-URL: repository, https://github.com/Nikhilsinghbora/llm-guardrails
Project-URL: issues, https://github.com/Nikhilsinghbora/llm-guardrails/issues
Project-URL: changelog, https://github.com/Nikhilsinghbora/llm-guardrails/blob/main/docs/changelog.md
Project-URL: source, https://github.com/Nikhilsinghbora/llm-guardrails
Project-URL: original-project, https://github.com/protectai/llm-guard
Keywords: llm,language model,security,adversarial attacks,prompt injection,prompt leakage,PII detection,self-hardening,firewall,atr-scanner,agent-threat-rules
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: <3.15,>=3.10
Description-Content-Type: text/markdown
Requires-Dist: bc-detect-secrets>=1.5.43
Requires-Dist: faker<38,>=37
Requires-Dist: fuzzysearch<0.9,>=0.7
Requires-Dist: json-repair>=0.44.1
Requires-Dist: nltk<4,>=3.9.1
Requires-Dist: presidio-analyzer>=2.2.362
Requires-Dist: presidio-anonymizer>=2.2.362
Requires-Dist: regex>=2024.11.6
Requires-Dist: tiktoken<1.0,>=0.9
Requires-Dist: torch>=2.4.0
Requires-Dist: transformers<5,>=4.52.1
Requires-Dist: structlog>=24
Provides-Extra: onnxruntime
Requires-Dist: optimum[onnxruntime]<2,>=1.26.0; extra == "onnxruntime"
Provides-Extra: onnxruntime-gpu
Requires-Dist: optimum[onnxruntime-gpu]<2,>=1.26.0; extra == "onnxruntime-gpu"
Provides-Extra: docs-dev
Requires-Dist: mkdocs<2,>=1.6; extra == "docs-dev"
Requires-Dist: mkdocs-autorefs==1.4.1; extra == "docs-dev"
Requires-Dist: mkdocs-git-revision-date-localized-plugin>=1.4.0; extra == "docs-dev"
Requires-Dist: mkdocs-jupyter>=0.25.1; extra == "docs-dev"
Requires-Dist: mkdocs-material>=9.6.14; extra == "docs-dev"
Requires-Dist: mkdocs-material-extensions>=1.3.1; extra == "docs-dev"
Requires-Dist: mkdocs-swagger-ui-tag>=0.7.1; extra == "docs-dev"
Provides-Extra: dev
Requires-Dist: llm_guard[docs-dev]; extra == "dev"
Requires-Dist: autoflake<3,>=2; extra == "dev"
Requires-Dist: pytest<9,>=8.3.5; extra == "dev"
Requires-Dist: pytest-cov<7,>=6.1.1; extra == "dev"
Requires-Dist: pre-commit<5,>=4.2.0; extra == "dev"
Requires-Dist: pyright~=1.1.400; extra == "dev"
Requires-Dist: ruff==0.11.10; extra == "dev"

# LLM Guard Rails - Comprehensive Security Toolkit for LLM Interactions

> **About**: This is an actively maintained fork of the original [LLM Guard](https://github.com/protectai/llm-guard) project by [Protect AI](https://protectai.com/llm-guard). We maintain enhancements and improvements beyond the original project, ensuring continuous updates and feature development.

LLM Guard Rails is a comprehensive security toolkit designed to fortify the safety and security of Large Language Model (LLM) interactions. It provides robust protection against various attack vectors and malicious inputs with actively maintained enhancements.

[**Documentation**](https://github.com/Nikhilsinghbora/llm-guardrails) | [**Original Project**](https://github.com/protectai/llm-guard) | [**Getting Started**](./docs/get_started/quickstart.md)

[![GitHub
stars](https://img.shields.io/github/stars/protectai/llm-guard.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/protectai/llm-guard/stargazers/)
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI - Python Version](https://img.shields.io/pypi/v/llm-guard)](https://pypi.org/project/llm-guard)
[![Downloads](https://static.pepy.tech/badge/llm-guard)](https://pepy.tech/project/llm-guard)
[![Downloads](https://static.pepy.tech/badge/llm-guard/month)](https://pepy.tech/project/llm-guard)

<a href="https://mlsecops.com/slack"><img src="https://github.com/protectai/llm-guard/blob/main/docs/assets/join-our-slack-community.png?raw=true" width="200" alt="Join Our Slack Community"></a>

## What is LLM Guard?

![LLM-Guard](https://github.com/protectai/llm-guard/blob/main/docs/assets/flow.png?raw=true)

By offering sanitization, detection of harmful language, prevention of data leakage, and resistance against prompt
injection attacks, LLM-Guard ensures that your interactions with LLMs remain safe and secure.

## Installation

Begin your journey with LLM Guard Rails by downloading the package:

```sh
# Coming soon to PyPI as llm-guardrails
pip install llm-guard
```

Or install from source:

```sh
git clone https://github.com/Nikhilsinghbora/llm-guardrails.git
cd llm-guardrails
pip install -e .
```

## Getting Started

**Important Notes**:

- LLM Guard Rails is designed for easy integration and deployment in production environments. While it's ready to use
  out-of-the-box, please be informed that we're constantly improving and updating the repository.
- Base functionality requires a limited number of libraries. As you explore more advanced features, necessary libraries
  will be automatically installed.
- Ensure you're using Python version 3.10 or higher. Confirm with: `python --version`.
- We fully support Python 3.10, 3.11, 3.12, 3.13, and 3.14.
- Library installation issues? Consider upgrading pip: `python -m pip install --upgrade pip`.

**Examples**:

- Get started with [ChatGPT and LLM Guard](./examples/openai_api.py).
- Deploy LLM Guard as [API](https://protectai.github.io/llm-guard/api/overview/)

## Supported scanners

### Prompt scanners

- [Anonymize](https://protectai.github.io/llm-guard/input_scanners/anonymize/)
- [ATRScanner](./docs/input_scanners/atr.md) ⭐ **NEW**
- [BanCode](./docs/input_scanners/ban_code.md)
- [BanCompetitors](https://protectai.github.io/llm-guard/input_scanners/ban_competitors/)
- [BanSubstrings](https://protectai.github.io/llm-guard/input_scanners/ban_substrings/)
- [BanTopics](https://protectai.github.io/llm-guard/input_scanners/ban_topics/)
- [Code](https://protectai.github.io/llm-guard/input_scanners/code/)
- [Gibberish](https://protectai.github.io/llm-guard/input_scanners/gibberish/)
- [InvisibleText](https://protectai.github.io/llm-guard/input_scanners/invisible_text/)
- [Language](https://protectai.github.io/llm-guard/input_scanners/language/)
- [PromptInjection](https://protectai.github.io/llm-guard/input_scanners/prompt_injection/)
- [Regex](https://protectai.github.io/llm-guard/input_scanners/regex/)
- [Secrets](https://protectai.github.io/llm-guard/input_scanners/secrets/)
- [Sentiment](https://protectai.github.io/llm-guard/input_scanners/sentiment/)
- [TokenLimit](https://protectai.github.io/llm-guard/input_scanners/token_limit/)
- [Toxicity](https://protectai.github.io/llm-guard/input_scanners/toxicity/)

### Output scanners

- [ATRScanner](./docs/output_scanners/atr.md) ⭐ **NEW**
- [BanCode](./docs/output_scanners/ban_code.md)
- [BanCompetitors](https://protectai.github.io/llm-guard/output_scanners/ban_competitors/)
- [BanSubstrings](https://protectai.github.io/llm-guard/output_scanners/ban_substrings/)
- [BanTopics](https://protectai.github.io/llm-guard/output_scanners/ban_topics/)
- [Bias](https://protectai.github.io/llm-guard/output_scanners/bias/)
- [Code](https://protectai.github.io/llm-guard/output_scanners/code/)
- [Deanonymize](https://protectai.github.io/llm-guard/output_scanners/deanonymize/)
- [JSON](https://protectai.github.io/llm-guard/output_scanners/json/)
- [Language](https://protectai.github.io/llm-guard/output_scanners/language/)
- [LanguageSame](https://protectai.github.io/llm-guard/output_scanners/language_same/)
- [MaliciousURLs](https://protectai.github.io/llm-guard/output_scanners/malicious_urls/)
- [NoRefusal](https://protectai.github.io/llm-guard/output_scanners/no_refusal/)
- [ReadingTime](https://protectai.github.io/llm-guard/output_scanners/reading_time/)
- [FactualConsistency](https://protectai.github.io/llm-guard/output_scanners/factual_consistency/)
- [Gibberish](https://protectai.github.io/llm-guard/output_scanners/gibberish/)
- [Regex](https://protectai.github.io/llm-guard/output_scanners/regex/)
- [Relevance](https://protectai.github.io/llm-guard/output_scanners/relevance/)
- [Sensitive](https://protectai.github.io/llm-guard/output_scanners/sensitive/)
- [Sentiment](https://protectai.github.io/llm-guard/output_scanners/sentiment/)
- [Toxicity](https://protectai.github.io/llm-guard/output_scanners/toxicity/)
- [URLReachability](https://protectai.github.io/llm-guard/output_scanners/url_reachability/)

## Community, Contributing, Docs & Support

LLM Guard Rails is an open source solution maintained as an active fork of the original LLM Guard project.
We are committed to a transparent development process and highly appreciate any contributions.
Whether you are helping us fix bugs, propose new features, improve our documentation or spread the word,
we would love to have you as part of our community.

### How We Differ

- **Active Development**: We maintain and release updates more frequently than the original project
- **Feature Requests Welcome**: We actively review and implement community feature requests
- **Responsive Maintenance**: Issues and PRs receive timely reviews and updates

### Recent Improvements & Updates

**Security & Bug Fixes:**
- ✅ Fixed CVE-2026-26007: Updated `presidio-anonymizer` to ≥2.2.362
- ✅ Fixed critical transformers vulnerability (GHSA-phhr-52qp-3mj4)
- ✅ Fixed Anonymize scanner to properly respect language parameter (#337)
- ✅ Fixed PromptInjection tokenizer initialization bug (#331)
- ✅ Fixed MaliciousURLs missing top_k parameter TypeError (#318)

**New Features & Enhancements:**
- ✅ **Python 3.13+ Support**: Full compatibility with Python 3.13 and 3.14
- ✅ **ATRScanner**: New Agent Threat Rule scanner with 10+ built-in detection patterns
- ✅ **ThresholdMixin**: Dynamically adjust scanner sensitivity without model reloading
- ✅ **Model.from_local()**: Factory method for locally-downloaded HuggingFace models
- ✅ Improved dependency management for better compatibility

### Get Involved

- Give us a ⭐️ github star ⭐️ on the top of this page to support what we're doing,
  it means a lot for open source projects!
- Read our
  [docs](./docs/index.md)
  for more info about how to use and customize LLM Guard Rails, and for step-by-step tutorials.
- Post a [Github Issue](https://github.com/Nikhilsinghbora/llm-guardrails/issues) to submit a bug report, feature request, or suggest an improvement.
- To contribute to the package, check out our [contribution guidelines](CONTRIBUTING.md), and open a PR.

### Support & Contact

We're eager to provide personalized assistance and discuss feature requests or improvements.

- [Send Email ✉️](mailto:nikhilsinghbora17@gmail.com) - Open to feature requests, improvements, and collaboration
- [GitHub Issues](https://github.com/Nikhilsinghbora/llm-guardrails/issues) - Report bugs or request features
