Back to search

Methodology

How OpenQalam Works

OpenQalam uses retrieval-augmented generation (RAG) to search across authenticated Islamic sources and present what they say about your question. Here is exactly what happens when you search:

  1. Your question is embedded — converted into a mathematical representation that captures its meaning, using Voyage AI.
  2. Sources are searched — both semantic similarity (meaning-based) and keyword matching (BM25) are used to find the most relevant hadith, scholar papers, and lecture clips from our database.
  3. Results are structured — an AI model (Claude by Anthropic) reads the retrieved sources and organizes them into a structured answer card with four sections: Foundation (hadith), Scholar Insights, Contemporary Voices, and Common Threads.
  4. You see the sources — every piece of text shown is quoted verbatim from the original source, with full citation. The AI selects and arranges — it never generates religious content.

What the AI Does and Does Not Do

The AI does:

  • Select the most relevant sources for your question
  • Organize sources into a structured answer card
  • Identify common themes across sources
  • Flag when sources don't fully answer your question

The AI never:

  • Issues religious rulings (fatwa)
  • Paraphrases or summarizes sacred text
  • Generates new religious content
  • Merges different scholars' views into one position
  • Says “Islam says...” or speaks on behalf of the religion

Hadith Grading

Each hadith is shown with its authentication grade when available:

  • SahihAuthentic — the highest grade of reliability
  • HasanGood — reliable with minor chain considerations
  • Da'ifWeak — included for completeness, always labeled

Hadith from Sahih al-Bukhari and Sahih Muslim are universally accepted as authentic and do not display a grade badge. All other collections show the grading explicitly.

Source Reliability Labels

Different source types have different levels of reliability. OpenQalam labels each clearly:

  • Hadith collections — verbatim text from authenticated classical collections. The gold standard of Islamic primary sources.
  • Scholar-reviewed papers — excerpts from peer-reviewed Islamic scholarship, quoted verbatim with author and publication attribution.
  • Auto-generated transcripts— YouTube lecture transcripts are used to find relevant clips. The video itself is the authoritative source. Transcripts are always labeled: “Auto-generated transcript — watch video for exact wording.”

Coverage Honesty

When our sources don't fully answer your question, we say so. You may see a coverage note explaining what's missing — for example, that we don't yet have lecture clips on a particular topic, or that the question falls outside our current source corpus.

This is intentional. We would rather be honest about gaps than stretch thin matches to look comprehensive. Trust is more important than completeness.

Technology

  • Search: hybrid vector + keyword (pgvector + BM25 with Reciprocal Rank Fusion)
  • Embeddings: Voyage AI voyage-4
  • Answer generation: Claude by Anthropic (structured output, retrieval-only prompt)
  • Database: Supabase (PostgreSQL with pgvector)
  • Fully open source: github.com/openqalam/openqalam