Documents
TXT, Markdown, PDF, DOCX and XLSX files are loaded from a local corpus and split into overlapping chunks.
PROTOTYPE · RAG · ISLAMIC FINANCE
An educational AI agent takes a question on Islamic finance, finds relevant fragments in a local document corpus and returns an answer with source references, scores and chunk identifiers.
The task
Questions about murabaha, riba or the functions of a Sharia committee require grounding in documents, not just a language model's memory. The prototype separates fact retrieval from answer generation and shows which fragments were used.
Pipeline
TXT, Markdown, PDF, DOCX and XLSX files are loaded from a local corpus and split into overlapping chunks.
Semantic search via embeddings is combined with lexical search on exact terms.
Optional CrossEncoder refines the candidate order before passing to the model.
The model receives the selected fragments; the Gradio interface shows the answer, sources, score and chunk ID.
Implemented system
A unified ingestion layer for text, documents, tables and PDFs.
Index and chunks are built by a separate ingest script and loaded by the application.
Message history, example questions and a dedicated sources block.
.envKeys are not committed and are excluded from Git; only a configuration template is public.
Ingestion, embeddings, storage, retrieval and agent are split into components.
The project includes tests and reproducible run instructions.
Status and boundaries
The system demonstrates RAG architecture and information retrieval. Answers require specialist verification, are not investment advice or a fatwa, and do not replace a Sharia board decision or legal expertise.