Project Overview
Aceh Agentic RAG + OCR is the backend for a self-hosted government document intelligence platform. It serves internal Pemprov Aceh users, retrieves from 100,000+ documents, answers in Bahasa Indonesia and English, and keeps all document storage, inference, retrieval, prompt management, and observability inside client-controlled Huawei Cloud.
Platform boundary
The platform provides backend APIs and WebSocket surfaces for chatbot, dashboard, batch-upload, and integration clients. It includes upload, ingestion status, search, query, OCR, retrieval, answer synthesis, Policy Guard, observability, and administrative API capabilities.
Primary users and documents
The platform is designed for 10-50 internal concurrent users. The corpus includes government legal, public-information, open-data, and one-data material from JDIH, PPID, OpenData, and SatuData, plus manually uploaded or batch-ingested documents.
Core capabilities
| Capability | Purpose | Availability |
|---|---|---|
| Multi-format ingestion | Parse, OCR, validate, chunk, embed, and index documents | Core capability, with source connectors expanding over time |
| OCR System | Extract text from scanned images/PDFs and route low-confidence text to review | Core capability, with human-review workflows layered on top |
| Hybrid retrieval | Semantic pgvector search plus PostgreSQL full-text search fused by RRF | Core capability |
| Grounded answering | Synthesizer returns cited answers with a faithfulness check | Core capability |
| Policy Guard | Anti-SARA, anti-jailbreak, government communication filtering | Core capability, hardened through evaluation |
| Long-Term Memory | Conversation persistence and session resume | Planned API capability for multi-turn use |
| Agentic orchestration | Router, Planner, Executor wrapping the Synthesizer | Planned capability for complex questions |
| Tool registry | Vector Search plus Excel Query, SQL Query, Legal Check, Summarizer, Cross-Reference | Vector Search first, then domain-specific tools |
| Evaluation | Golden dataset, retrieval metrics, answer faithfulness, citation accuracy | Acceptance and continuous-quality capability |
System spine
API clients
-> FastAPI service
-> ingestion / query / search service layer
-> PostgreSQL + pgvector + full-text search
-> LiteLLM / model endpoints
-> Langfuse tracing and prompt management
-> audit log
The platform prioritizes the ingestion to retrieval to grounded-answer path first. Agentic orchestration and multi-turn memory build on that retrieval spine so answers stay grounded in indexed government documents.
Non-negotiable constraints
- Data and inference stay inside Huawei Cloud. No external SaaS or data egress for delivered operation.
- Delivered dependencies must be OSI-licensed open source.
- Retrieval is hybrid by default. Semantic-only retrieval is not acceptable.
- Every answer needs source citations and faithfulness gating.
- OCR confidence is recorded, and low-confidence OCR is not indexed as normal text.
- Government Policy Guard wraps every generated answer.