LLM Guard - The Security Toolkit for LLM Interactions
Introduction to LLM Guard
LLM Guard is a sophisticated security tool developed by Protect AI to ensure safe interactions with Large Language Models (LLMs). Whether it's sanitizing input, detecting harmful language, preventing data leaks, or combating prompt injection attacks, LLM Guard is tailored to protect your exchanges with LLMs, ensuring they remain secure and trustworthy.
Installation
Getting started with LLM Guard is straightforward. To begin, simply install the package with the following command:
pip install llm-guard
How to Get Started
To make the most of LLM Guard, here are some essential steps and insights:
- LLM Guard is built for seamless integration into production environments. It’s user-ready out-of-the-box but continues to evolve with regular updates.
- The core features depend on a minimal set of libraries, and any additional libraries required for advanced functionalities are installed as needed.
- Ensure that your Python version is 3.9 or higher by running
python --version
. - If you encounter any library installation issues, upgrading pip with
python -m pip install --upgrade pip
may resolve the problem.
Explore examples like integrating with ChatGPT and LLM Guard or deploying it as an API.
Supported Scanners
LLM Guard strengthens security with a variety of scanners, including prompt and output scanners. These tools inspect inputs and outputs for security threats and consistency:
Prompt Scanners
- Anonymize: Protects user identity.
- BanCode, BanCompetitors, BanSubstrings, BanTopics: Restrict unwanted content or references.
- Code, Gibberish, InvisibleText, Language, PromptInjection: Detect and manage inappropriate or harmful text.
- Regex, Secrets, Sentiment, TokenLimit, Toxicity: Ensure content follows predefined patterns or limits.
Output Scanners
- BanCode, BanCompetitors, BanSubstrings, BanTopics: Block undesirable output.
- Bias, Code, Deanonymize, JSON, Language, LanguageSame: Maintain fairness and correct formatting.
- MaliciousURLs, NoRefusal, ReadingTime, FactualConsistency: Validate links and content credibility.
- Gibberish, Regex, Relevance, Sensitive, Sentiment, Toxicity, URLReachability: Enhance clarity and appropriateness in content delivery.
Community, Contributions, and Support
LLM Guard thrives as an open-source initiative and welcomes community participation:
- Support the project with a ⭐️ star on GitHub to help boost its visibility.
- The documentation provides comprehensive guidance on usage and customization.
- To report bugs or suggest improvements, create a GitHub Issue.
- For contributions, check out the contribution guidelines and propose changes through pull requests (PRs).
Join the LLM Guard Slack community to connect with the creators and other users, exchange feedback, seek assistance, and engage in discussions around LLM security.
Production Support
The LLM Guard team is ready to offer tailored support for deploying your solution in a production setting. For personalized assistance, contact them via email at [email protected].