A Retrieval-Augmented Generation (RAG) system for intelligent, context-aware consultation of the 1945 Constitution of the Republic of Indonesia.
AI UUD Intelligence is a domain-specific Retrieval-Augmented Generation (RAG) application designed to provide accurate, legally-grounded answers about the Undang-Undang Dasar Negara Republik Indonesia 1945 — the founding constitution of Indonesia. Built with LangChain, ChromaDB, and a fine-tuned Llama 3.2 1B model, it enables citizens, students, and legal professionals to query the constitution using natural language.
Rather than relying solely on a language model's parametric knowledge, every answer is grounded in retrieved constitutional text, structured by chapter (BAB), article (Pasal), and verse (Ayat) — ensuring traceability and accuracy in every response.
The system is divided into three distinct layers: document ingestion and indexing, semantic retrieval, and LLM-driven answer generation. These are orchestrated by a LangChain RAG chain and presented through a Streamlit front-end.
Core frameworks and libraries powering the system:
| Parameter | Value |
|---|---|
| Embedding Model | all-MiniLM-L6-v2 |
| Search Type | similarity_score_threshold |
| Score Threshold | 0.7 |
| Top-K Results | 3 |
| Device | CUDA (GPU) |
| Persistence | Disk (ChromaDB) |
| Parameter | Value |
|---|---|
| Model | Llama-3.2-1B-Instruct |
| Precision | float16 |
| Device Map | auto |
| Max New Tokens | 1024 |
| Temperature | 0.01 |
| Task | text-generation |
The pipeline operates in two distinct phases: an Indexing Phase that runs once to build the knowledge base, and a Query Phase that runs on every user interaction. The diagram below maps to the numbered steps in the process flow diagram.
uud45_asli.pdf page-by-page, extracting raw text with page metadata. The custom parse_uud() function splits text into semantic chunks aligned with legal structure: BAB → Pasal → Ayat.all-MiniLM-L6-v2 into an embedding vector.parse_uud() to generate Document chunks./db via ChromaDBThe following video demonstrates the full AI UUD Intelligence system in action — from the Streamlit interface to live constitutional queries with retrieved context and LLM-generated responses.
Demo — AI UUD Intelligence · Constitutional RAG System · Adam Hubert