Skip to content

rafshanDev90/quranAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bayyan AI Logo

📖 Bayyan AI

A Specialized Quranic Scholar Assistant using RAG (Retrieval-Augmented Generation)

Stars Forks Issues License


🌟 Overview

Bayyan AI is an intelligent Quranic search and assistant platform built with modern AI technologies. It leverages Retrieval-Augmented Generation (RAG) to provide accurate, context-aware answers to questions about the Quran, ensuring every response is backed by authentic verses with citations .

🚀 Key Features

  • Semantic Search: Find verses based on meaning, not just keywords.
  • RAG-Powered Answers: Get direct answers synthesized from Quranic context using LLMs.
  • Strict Citations: Every claim includes Surah name, number, and Ayah reference.
  • Multilingual Support: Displays both Arabic text and English translations.
  • Session Memory: Remembers conversation history using Redis.

🛠️ Tech Stack

python
Python
fastapi
FastAPI
chromadb
ChromaDB
mongodb
MongoDB
redis
Redis
  • Core Framework: FastAPI (Backend API)
  • Vector Database: ChromaDB (Vector Search)
  • Primary Database: MongoDB (Source Quranic Data)
  • LLM Orchestration: LangChain + Groq (Llama 3.1)
  • Embeddings: Sentence-Transformers (all-MiniLM-L6-v2)

📁 Project Structure

bayyan-AI/
├── bot/                # Telegram Bot (Node.js)
│   ├── commands/        # Modular command handlers (start, help, query)
│   ├── utils/           # Utility functions (logger, etc.)
│   ├── index.js         # Bot entry point
│   └── package.json     # Node.js dependencies
├── src/
│   ├── main.py          # FastAPI entry point & API routes
│   ├── orchestrator.py  # RAG logic & LLM chain configuration
│   ├── preprocess.py    # Data ingestion from MongoDB to ChromaDB
│   └── search.py        # Vector search implementation
├── quran_vectordb/      # Local vector database storage
├── requirements.txt     # Python dependencies
└── .env                 # Environment variables configuration

⚙️ Getting Started

1. Prerequisites

  • Python 3.9+
  • MongoDB instance
  • Redis instance (optional for session history)
  • Groq API Key

2. Installation

git clone https://github.com/rafshandev/bayyan-ai.git
cd bayyan-ai
pip install -r requirements.txt

3. Environment Setup

Create a .env file in the root directory:

# Backend Config
MONGO_URI=your_mongodb_uri
GROQ_API_KEY=your_groq_api_key
REDIS_URL=your_redis_url

# Telegram Bot Config
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
BAYYAN_API_URL=http://localhost:8000

4. Running the Telegram Bot

In a new terminal:

cd bot
npm install
node index.js

4. Data Ingestion

Vectorize the Quranic data from MongoDB:

python src/preprocess.py

5. Running the API

uvicorn src.main:app --reload

The API will be available at http://localhost:8000.


🛰️ API Endpoints

Method Endpoint Description
GET / Welcome message
GET /search?q={query} Get AI-generated answer and relevant verses

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License.

Built with ❤️ for the Ummah

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors