Repository navigation
HamiKnowledge v1.0.0 — Official Production Release
HamiKnowledge v1.0.0 — Official Production Release
Multi-user RAG knowledge platform for technical engineering teams querying English, Persian, and mixed-language technical documentation, with structurally verifiable source citations, calibrated abstention, and per-query budget accounting.
🌟 Highlights & Major Features
1. Robust Multi-User Isolation & Document ACLs
- Strict server-side authorization enforcement embedded directly inside SQL predicates (
workspace_id = :ws_id) and vector filter clauses. - Document-level ACLs ensuring restricted content is excluded before candidate retrieval, preventing cross-tenant leakage.
2. Evaluated Multilingual RAG Retrieval Pipeline (B0–B3)
- B0 (Lexical FTS): PostgreSQL full-text search with Persian normalization (Unicode normalizer, letter mapping, ZWNJ half-space preservation).
- B1 (Dense Vector): Exact cosine vector retrieval powered by pinned
intfloat/multilingual-e5-smallembeddings (384 dimensions). - B2 (Hybrid RRF — Production Default): Reciprocal Rank Fusion blending keyword precision and dense semantic search with sub-1.1s p95 latency.
- B3 (Hybrid RRF + Cross-Encoder Reranker): High-precision reranking using
cross-encoder/ms-marco-MiniLM-L-6-v2, achieving +0.069 nDCG@10 uplift.
3. Structural Citation Verification & Calibrated Abstention
- 100% Structural Citation Validity: Every citation links to verified character offsets (
[start_char..end_char]) in retrieved passages. - Calibrated Abstention: Declines to hallucinate on unanswerable questions, providing honest abstention badges alongside relevant context.
4. Thread-Safe Atomic Budget Ledger & Cost Controls
- Conservative cost ceiling reservation ($0.001) prior to external inference execution, reconciled to actual spend afterward.
- Stress-tested under 20 concurrent threads against tight budgets with zero overdraft and zero unreserved calls.
5. Bounded Read-Only Agent (R4)
- Hard limit of maximum 3 tool calls and 20-second request deadline.
- Strictly two read-only tools:
search_documentsandget_document_excerpt, both enforcing caller permissions on the server. - Loop termination on repeated calls and untrusted content barrier preventing prompt injection exfiltration.
6. Document Lifecycle & Atomic Reindexing
- Immediate exclusion of deleted documents from search indices, previews, and scoped caches.
- Atomic reindexing: new index version activates only when all stages succeed; previous valid versions remain usable through failed attempts.
7. Interactive RTL-Correct Web Dashboard & API
- Native right-to-left layout for Persian text and mixed Latin terms using logical CSS properties.
- Workspace switcher, document uploader, citation inspector modal, and real-time financial metrics bar.
8. Production Deployment & CI Quality Gates
deploy/docker-compose.ymlfor PostgreSQL 16 (pgvector), Redis 7, MinIO S3, and API services.- Native HamiCloud application descriptor (
deploy/hamicloud-app.yaml). - Automated GitHub Actions CI workflow running linting, strict typing, 61 tests, and regression gates.
📊 Benchmark & Evaluation Summary
| Benchmark Suite | Total Items | Passed | Pass Rate | Key Metric |
|---|---|---|---|---|
| Frozen Test Split (100 Items) | 100 | 100 | 100.0% | 0.3028 nDCG@10, 100% Citation Validity, p95: 1127.95 ms |
| Adversarial Benchmark (40 Items) | 40 | 40 | 100.0% | 12/12 Injection Blocked, 8/8 Revocation Respected, 6/6 Tools Safe |
| Automated Test Suite (pytest) | 61 | 61 | 100.0% | 0 failures in 2.34s |
| Mypy Static Typing (Strict) | 59 files | 59 | 100.0% | 0 type errors |
📦 Documentation & Evidence Records
- Evidence Record A0 — Defined Evidence
- Evidence Record A1 — Searchable Workspace
- Evidence Record A2 — RAG MVP Candidate
- Evidence Record A3 — Evaluated MVP
- Evidence Record A4 — Multi-User v1 Candidate
- Evidence Record A5 — HamiKnowledge v1.0 Release
🚀 Quickstart
git clone https://github.com/hami9/HamiKnowledge.git
cd HamiKnowledge
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install torch --index-url https://download.pytorch.org/whl/cpu
.\.venv\Scripts\python.exe -m pip install -e ".[models,dev]"
.\.venv\Scripts\uvicorn apps.api.main:app --host 0.0.0.0 --port 8000Open http://localhost:8000/ to access the dashboard.