Zero-dependency LLM hallucination detection middleware with billing & dashboard — real-time fact-checking proxy for LLMs
Project description
🔍 Hallucination Detector · 幻觉检测器
Zero-dependency LLM hallucination detection middleware. Like a CDN for AI safety. 零外部依赖的大模型幻觉检测中间件。像 CDN 一样守护 AI 安全。
🌐 Live Demo · 📖 Contributing · 🏥 Medical KB · ⚖️ Legal KB
⚡ 5-Second Demo · 5 秒体验
python3 hallucination_detector.py "朱元璋发明了火锅"
🔴 [contradicted] 朱元璋发明了火锅 (90%)
Evidence: 朱元璋是明朝开国皇帝,1328-1398 年
Source: 明史
English users try:
python3 hallucination_detector.py "Edison invented the light bulb"
🏗️ Architecture · 架构
User → awareness_gateway (OpenAI-compatible API)
├─ BillingMiddleware ← Pay-per-token
├─ ObserverSecurity ← Security middleware
├─ HallucinationDetector
│ ├─ 14 Checkers ← Weighted chain
│ ├─ Knowledge Graph ← 608 facts
│ ├─ Vector KB ← Hybrid search
│ └─ Web Verifier ← Cross-validation
├─ Consensus Engine
├─ Alignment Analyzer
└─ Feedback → Auto KB Updater (self-evolving)
🚀 Quick Start · 快速开始
Zero dependencies. Clone and run.
git clone https://github.com/malaxiya20250530-glitch/shiyan2925.git
cd shiyan2925
# CLI detection
python3 hallucination_detector.py "爱迪生发明了电灯泡"
# OpenAI-compatible gateway
python3 awareness_gateway.py --mock --port 8800
curl http://localhost:8800/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-f你的key" \
-d '{"model":"mock","messages":[{"role":"user","content":"你好"}]}'
# Dashboard
python3 dashboard_server.py --port 8080
# Open http://localhost:8080
💰 Monetization · 变现
# Create API keys with tiered plans
python3 billing.py create "Client A" pro # free / basic / pro / enterprise
python3 billing.py stats # MRR overview
python3 billing.py list # All accounts
| Plan | Monthly Quota | Rate Limit | Price |
|---|---|---|---|
| Free · 免费 | 10K tokens | 2 req/s | ¥0 |
| Basic · 基础 | 100K tokens | 5 req/s | ¥29 |
| Pro · 专业 | 1M tokens | 20 req/s | ¥199 |
| Enterprise · 企业 | Unlimited | 50 req/s | ¥999 |
🏥 Industry Knowledge Bases · 行业知识库
| Domain | Entries | File |
|---|---|---|
| Medicine · 医疗 | 45 | kb_medical.json |
| Law · 法律 | 52 | kb_legal.json |
| General · 通用 | 511 | kb_core.json |
python3 -c "from kb_loader import load_industry_kb; load_industry_kb()"
🔐 Binary Compilation · 加密编译
git push → GitHub Actions → .so for Linux / Mac / Windows
| Platform | Artifact |
|---|---|
| 🐧 Linux x86_64 | .so |
| 🍎 macOS arm64 | .so |
| 🍏 macOS x86_64 | .so |
| 🪟 Windows x86_64 | .pyd |
🧪 Testing · 测试
python3 test_fact_checker.py # Unit tests
python3 test_knowledge_graph.py # Knowledge graph
python3 test_observer_security.py # Security observer
python3 test_deepseek.py # End-to-end with DeepSeek
📊 Stats · 项目规模
- 17,733 lines Python · 61 modules · 14 checkers
- 608 facts · 6 CI workflows · 0 external deps
📄 License · 许可证
Proprietary · 专有软件. Contact author for commercial licensing. Copyright © 2025-2026 Li Qiao · 李桥
⭐ If this helps you, star this repo! 如果对你有用,点个 Star!
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 Distributions
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 llm_fact_guard-3.0.0-py3-none-any.whl.
File metadata
- Download URL: llm_fact_guard-3.0.0-py3-none-any.whl
- Upload date:
- Size: 189.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c1620755a5092faf083a6e70bec4535f5817d2ac241a6afa50fbd29ce1e2797
|
|
| MD5 |
63959884ef0fa69de190ceda7c4b3107
|
|
| BLAKE2b-256 |
34ab5f6a515d30c856199fef73d22082d6a3387e54dbfaa6f4d6d99bf5ae76f8
|