QuillGuard: A multi-layered security system for LLM applications
Project description
QuillGuard
A multi-layered security system for LLM applications, built on top of NeMo Guardrails.
Features
- NeMo Guardrails integration for content filtering
- OpenAI content generation with security checks
- Comprehensive security logging
- Easy-to-use SDK interface
- Configurable security rules
Installation
pip install quillguard
Quick Start
import asyncio
from duoguard_nemo import DuoGuardNemoSDK
async def main():
# Initialize the SDK
sdk = DuoGuardNemoSDK(
config_path="config", # Path to NeMo Guardrails config
openai_api_key="your-api-key", # Or use OPENAI_API_KEY env var
log_path="logs/security.log"
)
# Process a message
result = await sdk.process_message(
messages=[{"role": "user", "content": "Write an article about healthy eating."}],
system_prompt="You are an AI Article writer..."
)
if result["success"]:
print("Generated content:", result["response"])
else:
print("Error:", result["error"])
if __name__ == "__main__":
asyncio.run(main())
Configuration
NeMo Guardrails Config
Place your NeMo Guardrails configuration in the config directory. The SDK will use this for content filtering.
Environment Variables
OPENAI_API_KEY: Your OpenAI API key (optional if provided during initialization)
Security Logging
Security decisions and events are logged to logs/security.log by default. Each log entry includes:
- Timestamp
- Event type
- Message content
- Decision details
- Error information (if any)
Development
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
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 quillguard-0.1.0.tar.gz.
File metadata
- Download URL: quillguard-0.1.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68e51dba495526e8227738c974d5586ae4b224fb48bab4ee300a3478d760998e
|
|
| MD5 |
5395bc45898f0b5bb31c69ae549da9f5
|
|
| BLAKE2b-256 |
777d41b03a268ffa46a39e2f258de11dd89e8f0ed5d51e694512f65a386e9132
|
File details
Details for the file quillguard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quillguard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b279989bef21deda45c7a5b8b72fcf7179a9a179328e6755e52ec2ef2d2a0d3
|
|
| MD5 |
78efd0a09eb1cc1be7d2b475b2d156b3
|
|
| BLAKE2b-256 |
3fa287c9d7f0816f5adc1ae9095496011c4c697030a0ff7c5e11fb15b8a9aad0
|