Metadata-Version: 2.4
Name: guardrails-enterprise
Version: 0.2.0
Summary: Enterprise AI guardrails: input gateway, multi-agent debate output verification, confidence scoring, and RAG pipeline — all in one SDK.
License: MIT
Project-URL: Homepage, https://github.com/shashidharbabu/guardrails-enterprise
Project-URL: Repository, https://github.com/shashidharbabu/guardrails-enterprise
Project-URL: Issues, https://github.com/shashidharbabu/guardrails-enterprise/issues
Keywords: guardrails,llm,enterprise,rag,multi-agent,confidence-scoring,hallucination,pii,prompt-injection
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27
Requires-Dist: requests>=2.31
Requires-Dist: python-dotenv>=1.0
Requires-Dist: pydantic>=2.0
Provides-Extra: gateway
Requires-Dist: guardrails-ai>=0.5; extra == "gateway"
Requires-Dist: transformers>=4.40; extra == "gateway"
Requires-Dist: torch>=2.2; extra == "gateway"
Requires-Dist: spacy>=3.7; extra == "gateway"
Provides-Extra: rag
Requires-Dist: qdrant-client>=1.9; extra == "rag"
Requires-Dist: transformers>=4.40; extra == "rag"
Requires-Dist: torch>=2.2; extra == "rag"
Requires-Dist: huggingface-hub>=0.23; extra == "rag"
Requires-Dist: openai>=1.30; extra == "rag"
Provides-Extra: eval
Requires-Dist: deepeval>=3.0; extra == "eval"
Provides-Extra: rlhf
Requires-Dist: fastapi>=0.110; extra == "rlhf"
Requires-Dist: uvicorn[standard]>=0.29; extra == "rlhf"
Requires-Dist: pydantic>=2.0; extra == "rlhf"
Provides-Extra: mad-v4
Requires-Dist: langgraph>=0.2.50; extra == "mad-v4"
Requires-Dist: langchain>=0.3.0; extra == "mad-v4"
Requires-Dist: langchain-openai>=0.2.0; extra == "mad-v4"
Requires-Dist: langchain-community>=0.3.0; extra == "mad-v4"
Requires-Dist: langfuse>=2.50; extra == "mad-v4"
Requires-Dist: tenacity>=8.0; extra == "mad-v4"
Requires-Dist: qdrant-client>=1.9; extra == "mad-v4"
Requires-Dist: openai>=1.40; extra == "mad-v4"
Provides-Extra: backend
Requires-Dist: fastapi>=0.131; extra == "backend"
Requires-Dist: uvicorn[standard]>=0.41; extra == "backend"
Requires-Dist: gunicorn>=22.0; extra == "backend"
Requires-Dist: SQLAlchemy>=2.0; extra == "backend"
Requires-Dist: alembic>=1.18; extra == "backend"
Requires-Dist: psycopg2-binary>=2.9.9; extra == "backend"
Requires-Dist: python-jose[cryptography]>=3.3; extra == "backend"
Requires-Dist: passlib[bcrypt]>=1.7.4; extra == "backend"
Requires-Dist: anthropic>=0.40; extra == "backend"
Requires-Dist: redis>=5.0; extra == "backend"
Provides-Extra: all
Requires-Dist: guardrails-ai>=0.5; extra == "all"
Requires-Dist: transformers>=4.40; extra == "all"
Requires-Dist: torch>=2.2; extra == "all"
Requires-Dist: spacy>=3.7; extra == "all"
Requires-Dist: qdrant-client>=1.9; extra == "all"
Requires-Dist: huggingface-hub>=0.23; extra == "all"
Requires-Dist: deepeval>=3.0; extra == "all"
Requires-Dist: ragas>=0.1; extra == "all"
Requires-Dist: openai>=1.40; extra == "all"
Requires-Dist: langgraph>=0.2.50; extra == "all"
Requires-Dist: langchain>=0.3.0; extra == "all"
Requires-Dist: langchain-openai>=0.2.0; extra == "all"
Requires-Dist: langchain-community>=0.3.0; extra == "all"
Requires-Dist: langfuse>=2.50; extra == "all"

# Guardrails Enterprise — AI Guardrails & ML Infrastructure

Enterprise AI security and ML infrastructure platform. Wraps any enterprise LLM (healthcare, banking, legal, HR) with input and output guardrail layers, backed by a regulatory RAG corpus.

## 📁 Repository Structure

```
guardrails-enterprise/
├── docs/                    # All documentation
│   ├── README.md           # PII NER pipeline documentation
│   ├── QUICK_START.md      # Quick start guide
│   └── SETUP_GUIDE.md      # Detailed setup instructions
├── config/                  # Configuration files
├── dags/                    # Airflow DAGs
├── plugins/                 # Airflow plugins
├── scripts/                 # Utility scripts
│   ├── setup_airflow.sh
│   ├── start_airflow.sh
│   └── stop_airflow.sh
├── docker/                  # Docker configuration
│   ├── Dockerfile
│   └── docker-compose.yml
├── gateway/                 # Phase 1: Input guardrail (3 classifiers)
├── rag/                     # Phase 2: RAG pipeline (Qdrant + Qwen3-4B embedder)
├── multi_agent/             # Phase 3: MAD output guardrail (active)
├── multi_agent_debate/       # MAD pipeline with SQLite storage for GRPO
├── confidence/              # Phase 4: Confidence Scoring Engine
├── rlhf/                    # Phase 5: GRPO feedback loop
├── finetuning/              # Fine-tuning scripts for all 4 models
├── synthetic_data/          # Synthetic evaluation dataset generation
├── MAD_SETUP_GUIDE.md       # Standalone MAD setup guide
└── requirements.txt         # Root-level shared dependencies
```

## 🚀 Quick Start

For detailed setup instructions, see:
- **[Quick Start Guide](docs/QUICK_START.md)** - Get started in 15 minutes
- **[Setup Guide](docs/SETUP_GUIDE.md)** - Comprehensive setup instructions
- **[Full Documentation](docs/README.md)** - Complete project documentation
- **[MAD Setup Guide](MAD_SETUP_GUIDE.md)** - Multi-Agent Debate service setup
- **[GRPO LoRA Deployment Handoff](docs/GRPO_LORA_DEPLOYMENT.md)** - Agent A/B adapter location, vLLM dynamic LoRA serving, AWS routing, runtime prompts, JSON schema, and eval summary

## ✅ Active Pipelines

### PII NER Pipeline
- **Location**: `dags/pii_ner_pipeline.py`
- **Purpose**: Download, EDA, and BIO NER transformation of the `ai4privacy/pii-masking-200k` dataset → GCS
- **Status**: ✅ Active
- **Tasks**: `download_from_huggingface` → `load_raw_data` → `perform_eda` → `transform_data` → `upload_processed_data`

### Multi-Agent Debate (MAD) Output Guardrail
- **Location**: `multi_agent/` (core pipeline), `multi_agent_debate/` (with SQLite storage)
- **Purpose**: Verifies enterprise LLM answers against a regulatory evidence corpus. Extracts atomic claims, runs a 2-cycle adversarial debate (Agent A vs Agent B), routes through a partially-blind judge, and returns a routing decision (DELIVER / RETRY / HARD_BLOCK / HUMAN_REVIEW)
- **Status**: ✅ Active
- **Run**: `uvicorn multi_agent.api:app --port 8001 --reload`

## 🔮 Planned / In Development

### Gateway — Input Guardrail
- **Location**: `gateway/`
- **Purpose**: 3 parallel classifiers (prompt injection, PII detection, jailbreak detection) with a weighted decision engine. Blocks threats before they reach the LLM.
- **Status**: 🚧 In Development

### RAG Pipeline
- **Location**: `rag/`
- **Purpose**: Qdrant vector store + Qwen3-4B embedder + BM25 hybrid + cross-encoder reranker over a 72+ regulatory document corpus
- **Status**: 🚧 In Development

### Confidence Scoring Engine
- **Location**: `confidence/`
- **Purpose**: Compute a final confidence score from LLM faithfulness, hallucination rate, RAG relevancy, and judge evaluation
- **Status**: 🚧 In Development

### GRPO Feedback Loop
- **Location**: `rlhf/`
- **Purpose**: GRPO-based fine-tuning loop for Agent A (Brier reward) and Agent B (precision reward) using data written by the MAD pipeline to SQLite
- **Status**: 🚧 In Development
- **Deployment handoff**: GRPO-finetuned Agent A/B LoRA adapters are shared through Drive. See [GRPO LoRA Deployment Handoff](docs/GRPO_LORA_DEPLOYMENT.md) for adapter file manifest, vLLM model names (`agent_a`, `agent_b`), prompts, JSON-only schema, generation settings, AWS serving notes, and held-out eval results.

### Finetuning Pipelines
- **Location**: `finetuning/`
- **Purpose**: Fine-tuning scripts for RoBERTa (jailbreak + PII), Llama-Prompt-Guard-2-86M (prompt injection), Qwen2.5-3B-Instruct (LLM generator), and Qwen3-4B (RAG embedder)
- **Status**: 🚧 In Development

### Synthetic Evaluation Dataset
- **Location**: `synthetic_data/`
- **Purpose**: Generate 200-example healthcare-domain evaluation set (4 error types: fully_correct, missing_caveat, hallucinated_specific, jurisdiction_blind) for MAD pipeline benchmarking
- **Status**: 🚧 In Development

## 🛠️ Development

### Prerequisites
- Docker & Docker Compose
- Python 3.10+
- Google Cloud Platform account (for GCS)
- Ollama (for MAD pipeline — `ollama pull qwen2.5:7b`)

### Airflow Setup
```bash
# Setup Airflow
./scripts/setup_airflow.sh

# Start services
./scripts/start_airflow.sh

# Stop services
./scripts/stop_airflow.sh
```

### MAD Pipeline (Quick Start)
```bash
pip install -r multi_agent/requirements.txt
ollama pull qwen2.5:7b && ollama serve
python -m multi_agent.run_test
```

## 📚 Documentation

- [PII NER Pipeline Docs](docs/README.md)
- [Quick Start Guide](docs/QUICK_START.md)
- [Setup Guide](docs/SETUP_GUIDE.md)
- [MAD Setup Guide](MAD_SETUP_GUIDE.md)
