An intelligent tutoring ecosystem with multimodal assistance, knowledge retrieval, and personalized assessment
- Overview
- Features
- Architecture
- Project Roadmap
- Tech Stack
- Project Structure
- Setup and Installation
- Configuration
- Data Pipelines
- Models and Training
- API Reference
- Contributing
- License
LearnSage is a comprehensive AI-powered learning platform designed to provide students with personalized educational support through advanced language models, retrieval systems, and adaptive learning agents. The platform combines multimodal input processing, semantic search, and dynamic assessment to create a seamless learning experience.
At its core, LearnSage addresses the key challenges in digital learning:
- Providing instant, accurate responses to academic queries
- Supporting different learning modalities (text, image, etc.)
- Offering personalized learning paths based on individual performance
- Delivering high-quality, contextually relevant educational content
Our solution integrates cutting-edge technologies including Large Language Models (LLMs), vector databases, OCR systems, and personalized recommendation engines to deliver a truly adaptive learning experience.
- Text and Image Input Support: Submit questions via text or by uploading images of handwritten notes or textbook pages
- OCR Processing: Automatic extraction of text from uploaded images
- Context-Aware Responses: AI-generated explanations that consider the specific subject and difficulty level
- Adaptive Difficulty: Quizzes that adjust based on student performance
- Subject-Specific Generation: Tailored questions for different academic disciplines
- Grammar and Quality Assurance: Automatic verification of quiz content quality
- Structured JSON Output: Clean formatting of quiz data for consistent presentation
- Vector Database Integration: FAISS-powered semantic search for relevant educational content
- Context Enhancement: RAG (Retrieval-Augmented Generation) pipeline for accurate information retrieval
- Efficient Indexing: Fast content access with millisecond response times
- Performance Tracking: Monitoring of student progress across subjects and topics
- Dynamic Difficulty Adjustment: Content adaptation based on proficiency levels
- Personalized Feedback: Custom explanations for incorrect answers
- Learning Path Optimization: Suggested topics and resources based on progress
- YouTube Integration: Automatic retrieval of relevant educational videos
- Web Content Extraction: Targeted scraping of educational resources
- Resource Ranking: Embedding-based similarity scoring for content relevance
- Smart Notification System: Timely reminders to review explanations and complete learning activities
- Progress Visualization: Interactive dashboards showing learning advancement
- Session Continuity: Seamless resumption of learning activities across sessions
LearnSage follows a modern microservices architecture designed for scalability, maintainability, and performance.
┌─────────────────────────────────────────────────────────────────────┐
│ Client Layer │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Web Client │ │ Mobile Client │ │ API Client │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ API Gateway │
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ Auth │ │ Routing │ │ Rate │ │ Logging │ │
│ │ Service │ │ Service │ │ Limiting │ │ Service │ │
│ └────────────┘ └────────────┘ └────────────┘ └────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Application Services │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ User │ │ Quiz │ │ Doubt │ │
│ │ Service │ │ Service │ │ Resolver │ │
│ └──────────────┘ └──────────────┘ └───────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ Content │ │ Analytics │ │ Notification │ │
│ │ Service │ │ Service │ │ Service │ │
│ └──────────────┘ └──────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ AI & ML Services │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ LLM │ │ OCR │ │ Vector │ │
│ │ Service │ │ Service │ │ Search │ │
│ └──────────────┘ └──────────────┘ └───────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ Prompt │ │ Grammar │ │ Agent │ │
│ │ Engineering │ │ Check │ │ System │ │
│ └──────────────┘ └──────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Data Layer │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ PostgreSQL │ │ Redis │ │ FAISS │ │
│ │ Database │ │ Cache │ │ Vector DB │ │
│ └──────────────┘ └──────────────┘ └───────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ S3 / Blob │ │ Monitoring │ │
│ │ Storage │ │ Data │ │
│ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
-
Query Processing Flow:
- User submits a query (text or image)
- If image, OCR Service extracts text
- Query is processed by LLM Service with context from Vector Search
- Response is generated and returned to the user
-
Quiz Generation Flow:
- User requests a quiz for a specific subject/topic
- Quiz Service coordinates with LLM Service to generate questions
- Grammar Check Service ensures quality
- Generated quiz is stored and presented to the user
-
Learning Analytics Flow:
- User interactions and performance are logged
- Analytics Service processes the data
- Agent System uses analytics to personalize future content
- Notification Service triggers relevant reminders
LearnSage development follows a phased approach:
- Basic platform architecture and infrastructure setup
- Initial user authentication and profile management
- Core database schema and API design
- Simple text-based query resolution with LLM integration
- Multimodal input processing (text and images)
- Basic quiz generation functionality
- Initial vector search implementation
- Frontend user interface development
- Deployment pipeline establishment
- Enhanced RAG pipeline for improved accuracy
- Sophisticated prompt engineering techniques
- Adaptive quiz difficulty based on user performance
- Integration with YouTube API for content curation
- Notification system implementation
- Advanced learning analytics dashboard
- Personalized learning paths generation
- Content recommendation engine
- Performance prediction models
- Extended subject coverage
- Infrastructure optimization for higher user loads
- Enhanced security features
- Mobile application development
- API marketplace for third-party integrations
- Enterprise deployment options
LearnSage utilizes a modern technology stack:
- Framework: React.js with Next.js
- State Management: Redux
- Styling: Tailwind CSS
- API Client: Axios
- Testing: Jest, React Testing Library
- Framework: Django (Python)
- API: Django Rest Framework
- Authentication: JWT
- Task Queue: Celery with Redis
- WebSockets: Django Channels
- Primary Database: PostgreSQL
- Caching: Redis
- Vector Storage: FAISS
- File Storage: AWS S3
- LLM Integration: LangChain
- Language Models: Gemini
- OCR Processing: Amazon Textract
- Grammar Checking: Custom grammar API
- Embeddings: Sentence Transformers
- Containerization: Docker
- Orchestration: Kubernetes
- CI/CD: GitHub Actions
- Monitoring: Prometheus, Grafana
- Logging: ELK Stack
The LearnSage codebase follows a modular organization:
learnsage/
│
├── ai_tutor/ # Main Django app module
│ ├── migrations/ # Database migrations
│ │ ├── __init__.py
│ │ └── 0001_initial.py
│ ├── __init__.py
│ ├── admin.py # Admin panel configuration
│ ├── apps.py # App configuration
│ ├── models.py # Database models
│ ├── serializers.py # API serializers
│ ├── tests.py # Unit tests
│ ├── urls.py # URL routing
│ └── views.py # View controllers
│
├── ai_tutor_bkend/ # Django project settings
│ ├── __init__.py
│ ├── asgi.py # ASGI configuration
│ ├── settings.py # Project settings
│ ├── urls.py # Project URLs
│ └── wsgi.py # WSGI configuration
│
├── frontend/ # React frontend application
│ ├── public/ # Static assets
│ │ ├── fonts/ # Font files
│ │ ├── img/ # Image assets
│ │ ├── js/ # JavaScript files
│ │ ├── videos/ # Video files
│ │ ├── favicon.ico # Site favicon
│ │ ├── index.html # Main HTML file
│ │ └── vite.svg # Vite logo
│ │
│ └── src/ # Frontend source code
│ ├── assets/ # Frontend assets
│ ├── components/ # Reusable UI components
│ ├── constants/ # Constants and configuration
│ ├── sections/ # Page sections
│ ├── App.css # Application styles
│ ├── App.jsx # Main React component
│ ├── index.css # Global styles
│ ├── main.jsx # Entry point
│ └── color.txt # Color palette
│
├── manage.py # Django management script
└── README.md # Project documentation
- Python 3.9+
- Node.js 16+
- Docker and Docker Compose
- PostgreSQL 13+
- Redis 6+
-
Clone the repository:
git clone https://github.com/yourusername/learnsage.git cd learnsage
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
cd backend pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env # Edit .env with your configuration
-
Run migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
-
Install dependencies:
cd frontend npm install
-
Set up environment variables:
cp .env.example .env.local # Edit .env.local with your configuration
-
Start the development server:
npm run dev
For a complete containerized setup:
docker-compose up -d
This will start all necessary services including the database, Redis, backend, and frontend.
LearnSage uses a centralized configuration system with environment variables for different environments:
DEBUG
: Toggle debug modeSECRET_KEY
: Django secret keyALLOWED_HOSTS
: List of allowed hosts
DB_NAME
: PostgreSQL database nameDB_USER
: Database usernameDB_PASSWORD
: Database passwordDB_HOST
: Database hostDB_PORT
: Database port
LLM_API_KEY
: API key for the language model serviceOCR_API_KEY
: API key for OCR serviceEMBEDDING_MODEL
: Model name for embeddingsVECTOR_DB_PATH
: Path to the vector database
YOUTUBE_API_KEY
: YouTube API key for content curationGRAMMAR_API_KEY
: Grammar checking API key
REDIS_URL
: Redis connection stringCACHE_TIMEOUT
: Default cache timeout in seconds
LearnSage implements several data pipelines for processing educational content:
-
Source Acquisition:
- Educational PDFs, websites, and videos are identified
- Content is fetched via APIs or web scraping
-
Processing:
- Text extraction and cleaning
- Section identification and structuring
- Metadata extraction (subject, topic, difficulty)
-
Embedding Generation:
- Content is divided into chunks
- Embeddings are generated for each chunk
- Vectors are stored in FAISS database
-
Indexing:
- Content is indexed for fast retrieval
- Metadata is stored in PostgreSQL
- References are linked to original sources
-
Event Logging:
- User interactions are captured (queries, quiz attempts, etc.)
- Performance metrics are recorded
- Session data is aggregated
-
Processing:
- Data normalization and enrichment
- Pattern identification
- Performance scoring
-
Analytics Generation:
- Learning progress tracking
- Knowledge gap identification
- Personalization data preparation
LearnSage leverages several AI models for different functionalities:
We utilize Gemini through the LangChain framework for:
- Query resolution
- Quiz generation
- Content summarization
The models are accessed via API with carefully engineered prompts to ensure educational quality and accuracy.
For vector embeddings, we use:
- Sentence-BERT for general text embedding
- Domain-specific embeddings for specialized subjects
These models are used to convert educational content and queries into vector representations for semantic search.
For image processing and text extraction:
- Amazon Textract for high-quality OCR
- Custom post-processing for mathematical notation and diagrams
For personalized content suggestions:
- Collaborative filtering for user similarity
- Content-based filtering for topic relevance
- Hybrid approach for optimal recommendations
LearnSage exposes a comprehensive REST API:
POST /api/auth/register/
- Register new userPOST /api/auth/login/
- Login and get access tokenPOST /api/auth/refresh/
- Refresh access tokenPOST /api/auth/logout/
- Logout and invalidate token
GET /api/users/profile/
- Get user profilePUT /api/users/profile/
- Update user profileGET /api/users/progress/
- Get learning progress
POST /api/doubts/text/
- Submit text queryPOST /api/doubts/image/
- Submit image queryGET /api/doubts/history/
- Get query history
POST /api/quizzes/generate/
- Generate quizGET /api/quizzes/
- List quizzesGET /api/quizzes/{id}/
- Get quiz detailsPOST /api/quizzes/{id}/submit/
- Submit quiz answers
GET /api/content/search/
- Search educational contentGET /api/content/videos/
- Get related videosGET /api/content/recommended/
- Get recommended content
GET /api/analytics/performance/
- Get performance metricsGET /api/analytics/activity/
- Get activity summaryGET /api/analytics/insights/
- Get learning insights
We welcome contributions to LearnSage! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature-name
- Open a Pull Request
Please ensure your code follows our coding standards and includes appropriate tests.
LearnSage is licensed under the MIT License - see the LICENSE file for details.