System for generating, managing, and delivering multiple-choice questions (QCM - Questionnaire à Choix Multiples) from educational content. The system uses LLaMA for question generation, embeddings for keyword extraction, and provides both API and web interfaces for quiz delivery.
-
Intelligent Question Generation
- Automatic generation of multiple-choice questions from markdown content
- Keyword extraction using embedding-based similarity
- Natural language processing for French content
- Quality control and validation of generated questions
-
Flexible Backend API
- RESTful endpoints for question retrieval and quiz generation
- Subject and keyword-based filtering
- Random question selection
- Comprehensive statistics
-
Modern Web Interface
- Clean, responsive design using Next.js and Tailwind CSS
- Subject-based quiz selection
- Interactive quiz taking experience
- Immediate feedback and scoring
-
Question Generation
- Python 3.8+
- LLaMA 3.1 (via Ollama)
- spaCy (French language model)
- nomic-embed-text for embeddings
-
Backend
- FastAPI
- SQLite
- Pydantic
- uvicorn
-
Frontend
- Next.js 14
- React
- TypeScript
- Tailwind CSS
-
Ollama Setup
# Install Ollama curl -fsSL https://ollama.com/install.sh | sh # Pull required models ollama pull llama3.1:latest ollama pull nomic-embed-text
-
Python Dependencies
pip install -r requirements.txt python -m spacy download fr_core_news_md
-
Node.js Dependencies
cd frontend npm install
-
Clone the Repository
git clone https://github.com/yourusername/qcm-system.git cd qcm-system -
Set Up the Database
# Generate questions from markdown files python question_generator/main.py -
Start the Backend Server
cd backend uvicorn main:app --reload -
Launch the Frontend
cd frontend npm run dev
# config.py
GENERATOR_CONFIG = {
"model": "llama3.1:latest",
"embedding_model": "nomic-embed-text",
"num_questions_per_file": 5,
"min_content_length": 200
}# main.py
app = FastAPI(
title="QCM API",
description="API for serving multiple-choice questions",
version="1.0.0"
)# .env.local
NEXT_PUBLIC_API_URL=http://localhost:8000-
Prepare your educational content in markdown files:
# Topic Title Educational content goes here... -
Run the question generator:
python question_generator/main.py --input-dir /path/to/markdown/files
-
Get Available Subjects:
curl http://localhost:8000/subjects
-
Generate a Quiz:
curl "http://localhost:8000/quiz/generate?num_questions=10&subject=Mathematics"
- Visit
http://localhost:3000in your browser - Select a subject
- Start the quiz
- Answer questions and get immediate feedback
| Method | Endpoint | Description |
|---|---|---|
| GET | /subjects |
List all available subjects |
| GET | /keywords |
List all keywords |
| GET | /questions/random |
Get a random question |
| GET | /quiz/generate |
Generate a quiz |
| GET | /stats |
Get database statistics |
{
"id": 1,
"subject": "Mathematics",
"question_text": "What is 2+2?",
"choices": {
"A": "3",
"B": "4",
"C": "5",
"D": "6"
},
"answers": ["B"]
}# Backend tests
pytest backend/tests/
# Frontend tests
cd frontend
npm test- LLaMA team for the language model
- Ollama team for the model serving infrastructure
- spaCy team for the French language model
- More question types beyond multiple choice
- Enhanced analytics and reporting
- User authentication and progress tracking