Study Labs is a comprehensive personalized learning platform that leverages Artificial Intelligence to create adaptive learning experiences. It combines a modern, pastel-themed frontend with a powerful backend capable of processing documents and generating tailored course content, quizzes, and tutoring sessions.
This is not a thin chat wrapper around an LLM. The app implements a multi-stage retrieval-augmented learning system with user-isolated vector search, async ingestion, and tool-driven outline synthesis.
-
RAG Pipeline: Uploaded PDFs and YouTube transcripts are parsed, chunked, embedded, and indexed, then retrieved at query-time to ground tutor/chat/quiz generation.
-
Qdrant Vector Search: Context retrieval uses similarity search with metadata filters (
metadata.user_id) so each user only queries their own knowledge base. -
Async ETL + Ingestion: File extraction and YouTube transcript processing run concurrently with
asyncio+ worker threads for higher throughput. -
LangChain + Gemini Stack: LangChain loaders/splitters/vector store orchestration sit on top of Gemini embedding and chat models.
-
Tool-Calling Agent for Outlines: Outline generation uses a map-reduce style summarization workflow and a LangChain agent tool (
submit_outline) to produce structured course topology.
studyy.mp4
- ** Learning Paths**: AI-generated course outlines and lessons based on user inputs and uploaded documents.
- Interactive AI Tutor: A chatbot interface for real-time tutoring and doubt resolution.
- Dynamic Quizzes: Automatically generated quizzes to test knowledge and reinforce learning.
- Document Integration: Upload PDFs and provide YouTube URLs to generate context-aware learning materials.
- Progress Tracking: Visual indicators for course completion and lesson progress.
- Clean & Modern UI: A user-friendly interface built with Next.js and Tailwind CSS, featuring a soothing pastel color palette.
- Math Support: Rendering of mathematical equations using KaTeX.
-
Ingestion API
POST /upload_pdfsaccepts PDFs, optional YouTube URLs, and a requireduser_id. -
Async ETL
- PDFs are parsed page-by-page (text + embedded images via PyMuPDF).
- YouTube transcripts are loaded via LangChain's
YoutubeLoader. - Content is split with
RecursiveCharacterTextSplitter(chunk_size=2000, overlap200). - Processing runs concurrently using
asyncio.gather(...)andasyncio.to_thread(...).
-
Embedding + Indexing
- Chunks are embedded with
GoogleGenerativeAIEmbeddings(text-embedding-004). - Vectors are stored in Qdrant through
QdrantVectorStore. - Each chunk gets
metadata.user_idfor strict user-level context isolation.
- Chunks are embedded with
-
Retrieval-Augmented Generation
- Tutor/chat/quiz endpoints call user-scoped retrieval (
search_for_user) with a Qdrant metadata filter. - Retrieved chunks are injected into prompts to ground responses.
- Tutor can route to a vision-capable model when retrieved chunks include embedded image data.
- Tutor/chat/quiz endpoints call user-scoped retrieval (
-
Outline Synthesis (Map-Reduce + Tool Calling)
- Large corpora are summarized in batches to avoid context overflow.
- Summaries are reduced into a unified outline by a LangChain agent.
- The final structure is emitted through a typed tool call (
submit_outline) for predictable output shape.
flowchart LR
U[User in Next.js UI] --> API[Next.js API Routes]
API --> FAST[FastAPI Backend]
FAST --> IN[Async Ingestion and ETL]
IN --> PDF[PDF Parser and Image Extraction]
IN --> YT[YouTube Transcript Loader]
PDF --> SPLIT[Chunking: RecursiveCharacterTextSplitter]
YT --> SPLIT
SPLIT --> EMB[Gemini Embeddings: text-embedding-004]
EMB --> QD[(Qdrant Vector Store)]
FAST --> RET[User-Scoped Retrieval]
RET -->|metadata.user_id filter| QD
RET --> LLM[Gemini Chat and Vision Models]
LLM --> TUT[Tutor JSON Lesson]
LLM --> QUIZ[Quiz JSON Flashcards]
LLM --> CHAT[Chat Answer]
IN --> OUTL[Outline Pipeline]
OUTL --> MAP[Map: Batch Summaries]
MAP --> RED[Reduce: Unified Topic Graph]
RED --> TOOL[LangChain Tool Call: submit_outline]
TOOL --> COURSE[Course Outline Response]
- Framework: Next.js 13+ (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Radix UI, Lucide React
- Animations: Framer Motion
- Math Rendering: KaTeX
- Framework: FastAPI
- Language: Python
- AI/LLM: Gemini (
gemini-2.5-flash-lite) via LangChain - Embeddings: Gemini
text-embedding-004 - Vector Store: Qdrant Cloud (
langchain_qdrantintegration) - Orchestration: LangChain loaders, splitters, vector store, agent tool-calling
- Async Data Pipeline:
asyncio+ threaded loaders for concurrent file and YouTube processing
Study-Labs/
βββ backend/ # FastAPI Backend
β βββ app.py # Main application entry point
β βββ llm_services/ # AI/LLM logic (bot, outline generation)
β βββ loaders/ # Document loaders (PDF, etc.)
β βββ tools/ # Utility tools (embeddings, models)
β βββ qdrant_data/ # Vector store data
β βββ requirements.txt # Python dependencies
β
βββ frontend/ # Next.js Frontend
βββ app/ # App Router pages and layouts
βββ components/ # Reusable UI components
βββ lib/ # Utility functions and API clients
βββ package.json # Node.js dependencies
- Node.js (v18+ recommended)
- Python (v3.10+ recommended)
- Git
git clone https://github.com/Olaiwonismail/Study-Labs.git
cd Study-LabsNavigate to the backend directory:
cd backendCreate a virtual environment (optional but recommended):
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtSet up environment variables:
Create a .env file in the backend directory and add your API keys:
GOOGLE_API_KEY=your_google_api_key_hereRun the server:
uvicorn app:app --reloadThe backend API will be available at http://localhost:8000.
Open a new terminal and navigate to the frontend directory:
cd frontendInstall dependencies:
npm install
# or
yarn install
# or
pnpm installRun the development server:
npm run devThe frontend application will be available at http://localhost:3000.
- Sign Up/Login: Create an account to track your progress.
- Create a Course: Upload relevant PDF documents or provide YouTube links to generate a new course.
- Learn: Navigate through the generated lessons.
- Quiz: Take quizzes to test your understanding.
- Chat: Use the AI tutor for specific questions related to the course material.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request