RAG LLM FastAPI React Gemini Pro

StudyBuddy AI

AI-Powered Intelligent Study Companion with Multi-Agent RAG Architecture

StudyBuddy AI Interface

Screenshots

Overview

StudyBuddy AI is a cutting-edge educational platform that revolutionizes how students learn and prepare for exams. Using Google's Gemini Pro LLM combined with advanced Retrieval-Augmented Generation (RAG), it provides personalized, context-aware learning experiences tailored to each student's course materials.

7
AI Agents
6
Tech Stack Layers
384
Embedding Dimensions

Problem Statement

Traditional study methods lack personalization and intelligent feedback. Students struggle with:

  • Understanding which concepts to prioritize
  • Getting immediate, accurate answers to questions
  • Identifying knowledge gaps
  • Generating practice questions from course materials
  • Predicting likely exam questions

Solution

A multi-agent AI system that:

  • Processes any course material (PDFs, documents, presentations)
  • Extracts key concepts automatically using NLP
  • Generates personalized quizzes based on content analysis
  • Answers questions using RAG with course-specific context
  • Detects confusion patterns and provides targeted interventions
  • Predicts exam questions through content analysis

System Architecture

7-Layer Architecture

\n
1

User Interface

React 18.x Frontend with modern UI/UX

2

API Gateway

FastAPI Backend with async processing

3

Agent Orchestrator

Central coordination of AI agents

4

AI Agents

6 specialized agents for distinct tasks

5

RAG Pipeline

LangChain + FAISS vector search

6

AI Infrastructure

Gemini Pro, Embeddings, Vector Store

7

Storage Layer

SQLite + FAISS + File System

Multi-Agent System

Six specialized AI agents work together to create a comprehensive learning experience:

📄

Content Ingestion Agent

Processes PDFs, DOCX, PPTX files. Extracts text with OCR fallback, chunks content (1000 chars, 200 overlap), preserves metadata.

🧠

Concept Extractor Agent

Uses Gemini Pro to extract key concepts with importance scores (1-10), difficulty levels, and exam probability predictions.

📝

Quiz Generator Agent

Creates personalized quizzes with MCQs, True/False, short answer questions. RAG-enhanced with adaptive difficulty.

🎯

Exam Predictor Agent

Analyzes content to predict likely exam questions based on concept importance and probability algorithms.

🔍

Confusion Detector Agent

Identifies learning gaps from incorrect answers, suggests targeted interventions and study recommendations.

💡

Explanation Builder Agent

Generates custom explanations, creates mnemonics (acronyms, rhymes, stories), provides RAG-aware Q&A.

Application Interface

AI Chat Interface

AI-powered chat with RAG-enhanced responses and source attribution

Dashboard

Analytics dashboard with progress tracking and learning insights

Technical Implementation

RAG Pipeline

  1. Query Embedding: Convert user question to 384-dimensional vector using sentence-transformers (all-MiniLM-L6-v2)
  2. Vector Search: FAISS similarity search retrieves top-k relevant chunks from course materials
  3. Reranking: Composite scoring (semantic similarity + importance + recency) prioritizes best context
  4. Context Assembly: Build enriched prompt with retrieved chunks (max 4000 tokens)
  5. Generation: Gemini Pro generates answer with temperature=0.3 for accuracy

Technology Stack

Frontend

  • React 18.x
  • React Router v6
  • Axios
  • Lucide React Icons
  • CSS3

Backend

  • Python 3.11+
  • FastAPI
  • SQLAlchemy 2.0
  • Pydantic
  • aiosqlite

AI/ML

  • Google Gemini Pro 1.5
  • LangChain
  • Sentence-Transformers
  • FAISS Vector DB
  • PyPDF2 / pdfplumber

Real-World Use Cases

📚 Course Material Processing

Scenario: Student uploads lecture PDFs for a Computer Science course.

Flow:

  1. Content Ingestion Agent extracts text and creates embeddings
  2. Concept Extractor identifies key topics (e.g., "Binary Search Trees", "Dynamic Programming")
  3. Vector store enables semantic search across all materials

Result: Instant, searchable knowledge base from course PDFs

❓ Intelligent Q&A

Scenario: Student asks "What is the time complexity of quicksort?"

Flow:

  1. RAG pipeline retrieves relevant chunks from uploaded materials
  2. Gemini Pro generates answer using actual course context
  3. Response includes page references and source attribution

Result: Accurate answers grounded in course materials, not generic knowledge

📝 Adaptive Quiz Generation

Scenario: Student requests practice quiz on "Data Structures"

Flow:

  1. Quiz Generator selects concepts based on mastery levels
  2. RAG retrieves context for each concept
  3. Generates MCQs, True/False, and problem-solving questions
  4. Confusion Detector analyzes incorrect answers

Result: Personalized quiz that adapts to student's knowledge gaps

🎯 Exam Prediction

Scenario: Finals approaching, student wants to focus study time

Flow:

  1. Exam Predictor sorts concepts by probability and importance
  2. Generates realistic exam-style questions for top concepts
  3. Provides step-by-step solutions on demand

Result: Efficient studying focused on most likely exam topics

Engineering Achievements

Modular Architecture

Clean separation of concerns with multi-agent system allows easy addition of new capabilities

Optimized LLM Usage

Reduced token consumption through prompt engineering and context management (max 4000 tokens)

Production-Ready

Docker deployment, CI/CD pipeline, comprehensive testing, and monitoring for scalability

Robust Error Handling

Graceful fallbacks for API failures, comprehensive logging, and user-friendly error messages