Logo Lanfrica

AmanouNasri1/tunisian-learning-ai

Domain:

educationnatural language processing

Record type:

software
Creator:
Ama
Host:
# BacPilot AI — Exam Intelligence Layer AI-powered exam-preparation backend for the Tunisian Baccalauréat. **Current scope (intentionally narrow):** - Bac Mathématiques (section) - Bac Sciences Expérimentales (section) This repository is **only** the exam-intelligence and AI/data layer. It does NOT contain (and must not grow): frontend, payments, teacher marketplace, video platform, model fine-tuning. ## What this is A structured Bac knowledge database + retrieval (RAG) + a strong reasoning LLM. We do **not** train or fine-tune a model. We transform Bac PDFs and corrections into a clean, tagged, curriculum-weighted database, and let a strong LLM reason over retrieved, **cited** sources. If sources are weak or missing, the AI says so — it does not hallucinate. ## Stack - Django 5.1 + Django REST Framework - PostgreSQL + pgvector - LLM via swappable provider (Claude / OpenAI) — `ai/llm_client.py` - Embeddings via swappable provider (must handle FR / AR / Darja) — `ai/embeddings.py` --- ## Local setup ### Prerequisites - Python 3.10+ - PostgreSQL 14+ with the **pgvector** extension available (package `postgresql-NN-pgvector` on Linux, or the Windows pgvector build). ### 1. Create the database (PostgreSQL) Using `psql` as a superuser: ```sql CREATE DATABASE bacpilot; CREATE USER bacpilot WITH PASSWORD 'bacpilot'; GRANT ALL PRIVILEGES ON DATABASE bacpilot TO bacpilot; \c bacpilot CREATE EXTENSION IF NOT EXISTS vector; -- give the app user rights on the public schema (PostgreSQL 15+): GRANT ALL ON SCHEMA public TO bacpilot; ``` > The first migration also runs `CREATE EXTENSION IF NOT EXISTS vector;`. That only > works if the connecting user is a superuser. If your app user is not a superuser, > run the `CREATE EXTENSION` line above manually first (as a superuser). ### 2a. Windows (PowerShell) ```powershell python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt Copy-Item .env.example .env # then edit .env (DATABASE_URL, key …