Privacy-first, fully offline AI document assistant secured by tiered safety guardrails
Project description
🛡️ GuardRAG
Privacy-First, Fully Offline AI Document Assistant
Secured by a Tiered Safety Guardrails System
v1.2.4 — High-Performance, Secure, and Professional
Upload any document. Ask anything. Get answers — entirely on your local machine or using secure cloud endpoints.
Supports offline local models and OpenAI-compatible cloud APIs with fully customized security boundaries.
💡 What's New in v1.2.4
- 🌐 OpenAI-Compatible Cloud Integration: Easily switch to high-performance cloud endpoints (Groq, OpenRouter, OpenAI, Anthropic, Cohere) with full API key security.
- 🔄 Dynamic Model & Host Switching: Swap Ollama hosts or LLM models directly from the frontend UI without restarting the application or re-uploading documents.
- 🛡️ Tiered Safety Guardrails: Fully offline safety engine (Public, Internal, Confidential, Restricted) preventing jailbreaks, credential leaks, and PII leaks.
- 🦁 Brave Shields & CORS Fallback: Enhanced compatibility featuring automatic backend proxy health checks when direct local browser fetches are blocked by privacy shields.
- 📚 Document Library: Persisted document collections with a visual session management panel (rehydrate or delete stored FAISS indices).
- ⚡ Faster Indexing: Optimized FAISS batching and retrieval parameters.
💡 Use Cases
GuardRAG is designed for professionals and organizations that handle sensitive data and require the power of LLMs without compromising privacy.
- 🔒 Secure Document Analysis: Chat with confidential contracts, internal financial reports, or legal documents without uploading them to a cloud provider.
- 🏥 Healthcare & Privacy: Analyze medical records or research data locally, ensuring compliance with privacy standards like HIPAA or GDPR through integrated PII detection.
- 💻 Offline Research: Work on-the-go or in air-gapped environments. Once the models are downloaded, no internet connection is required.
- 🛠️ Developer Productivity: Quickly query local documentation or large codebases (via text/PDF) using a streamlined CLI or Web interface.
⚙️ Data Sensitivity Tiers
Protect your information using our built-in safety engine (processed entirely offline):
| Level | Protection Scope |
|---|---|
| 🟢 Public | Detects jailbreaks and basic prompt injections. |
| 🔵 Internal | Adds detection for API keys, credentials, and tokens. |
| 🟡 Confidential | Protects SSNs, emails, phone numbers, and credit card info. |
| 🔴 Restricted | Strict protection for medical history, HIPAA/GDPR, and financial data. |
📥 Installation
Install the package directly from PyPI:
# Recommended stable version
pip install guard-rag
Prerequisites
- Ollama (Optional for local execution): Download and install from ollama.com.
- Model: Pull a model to use locally (e.g.,
ollama pull gemma3:1b). - Windows Users: You must have the Microsoft Visual C++ Redistributable installed to run the AI engine.
🚀 Commands & Usage
GuardRAG provides a flexible CLI and a web interface to interact with your documents.
1. Launch the Web Interface
Simply run the command with no arguments to start the local server and open the UI in your browser:
guard-rag
2. Chat with a Document via CLI
Start an interactive chat session directly in your terminal:
guard-rag --pdf path/to/my_document.pdf
3. Advanced Configuration & Cloud Endpoints
Set environment variables for cloud LLMs (Groq, OpenRouter, OpenAI, etc.):
# Optional API Keys for cloud execution
export OPENAI_API_KEY="your-openai-api-key"
export GROQ_API_KEY="your-groq-api-key"
export OPENROUTER_API_KEY="your-openrouter-api-key"
Customize the model, server, and safety levels:
# Custom local model
guard-rag --pdf report.pdf --model llama3 --sensitivity Confidential --chunk-size 1000
# Cloud model via Groq API
guard-rag --pdf report.pdf --model llama-3.1-8b-instant --ollama-host https://api.groq.com/openai/v1 --sensitivity Restricted
📖 Available CLI Options
| Argument | Description | Default |
|---|---|---|
--pdf <file> |
Path to the PDF document you want to analyze. | Required for CLI |
--model <name> |
The Ollama or OpenAI-compatible model name. | gemma3:1b |
--ollama-host |
The URL of Ollama or OpenAI-compatible endpoint. | http://localhost:11434 |
--sensitivity |
Safety level: Public, Internal, Confidential, Restricted. |
Internal |
--chunk-size |
Size of document chunks for processing. | 1000 |
--chunk-overlap |
Overlap between document chunks. | 200 |
--no-guardrails |
Disable all safety checks (not recommended). | False |
--help |
Show all available commands and flags. | - |
Built with ❤️ by Sowmiyan S
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 guard_rag-1.2.6.tar.gz.
File metadata
- Download URL: guard_rag-1.2.6.tar.gz
- Upload date:
- Size: 79.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b9d69c75ca9f610df7277c21e45493c68bf88ade23ae4e45331750f4215b731
|
|
| MD5 |
23594e25c61d86ad72e8f20d0e55af36
|
|
| BLAKE2b-256 |
fc364c8dcacf5fdd09f53544083702b9d8b65da27d2c9056c2efa9c053ec1dd0
|
File details
Details for the file guard_rag-1.2.6-py3-none-any.whl.
File metadata
- Download URL: guard_rag-1.2.6-py3-none-any.whl
- Upload date:
- Size: 69.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f4df4f8c5f63c34c261d457d2404f582dd1b8c4d7763870b9da0e027f2bd43d
|
|
| MD5 |
df62c50aa8fea72ef7dbaa882df6cda1
|
|
| BLAKE2b-256 |
6b7975d86f783c6e84e9ec4e99a0b012f4378e9c20826294d732f8a61ae57f15
|