Metadata-Version: 2.4
Name: llm-guardrails-maintained
Version: 0.3.18
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) | [**PyPI Package**](https://pypi.org/project/llm-guardrails-maintained/) | [**Original Project**](https://github.com/protectai/llm-guard) | [**Getting Started**](./docs/get_started/quickstart.md)

[![GitHub stars](https://img.shields.io/github/stars/Nikhilsinghbora/llm-guardrails.svg?style=social&label=Star&maxAge=2592000)](https://github.com/Nikhilsinghbora/llm-guardrails/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 version](https://img.shields.io/pypi/v/llm-guardrails-maintained.svg)](https://pypi.org/project/llm-guardrails-maintained/)
[![Python 3.10+](https://img.shields.io/badge/Python-3.10%2B-brightgreen.svg)](https://www.python.org/downloads/)



## 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
pip install llm-guardrails-maintained
```

Or install from source:

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

## Getting Started

**Requirements & Notes**:

- **Python**: 3.10, 3.11, 3.12, 3.13, or 3.14 (`python --version` to verify)
- **Production-Ready**: Designed for easy integration in production environments with continuous improvements
- **Minimal Dependencies**: Base functionality requires minimal libraries; advanced features auto-install as needed
- **Troubleshooting**: If you encounter installation issues, upgrade pip: `python -m pip install --upgrade pip`

**Quick Examples**:

- [OpenAI Integration](./examples/openai_api.py) - Secure ChatGPT interactions
- [LangChain Integration](./examples/langchain.py) - LLM protection with LangChain
- [API Deployment](./docs/api/overview.md) - Deploy as a service
- [More Examples](./examples/) - Amazon Bedrock, Google Gemini, and streaming examples

## Supported scanners

### Prompt scanners

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

### Output scanners

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

## 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
- [GitHub Discussions](https://github.com/Nikhilsinghbora/llm-guardrails/discussions) - Ask questions and share ideas

---

## Acknowledgments

This project is a maintained fork of the excellent [LLM Guard](https://github.com/protectai/llm-guard) by [Protect AI](https://protectai.com/). We maintain this fork to provide:
- **Active Security Updates**: Prompt patches for CVEs and security vulnerabilities
- **Regular Bug Fixes**: Community-reported issues resolved quickly
- **New Features**: Enhancement requests implemented with community feedback
- **Continuous Support**: Regular releases and dependency updates

The original LLM Guard project by Protect AI deserves recognition for building this solid foundation.

### License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
