Skip to content

Dev0907/Demos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 EduMind Agent

EduMind Agent is an AI-powered autonomous learning and assessment platform that revolutionizes educational content creation and adaptive learning. Built with LangGraph, FastAPI, and Google's Gemini AI, it provides two powerful modes: Teacher Mode for generating comprehensive worksheets and Student Mode for adaptive quizzing and interactive learning.


🌟 Features

πŸŽ“ Teacher Mode

  • Automated Worksheet Generation: Upload PDF study materials (NCERT chapters, reference materials) and automatically generate structured worksheets
  • Multi-Format Questions: Creates both Multiple Choice Questions (MCQs) and subjective questions
  • Intelligent Topic Segmentation: Automatically identifies and segments topics from uploaded content
  • Customizable Output: Configure number of questions, difficulty levels, and question types
  • PDF Export: Generates professional PDF worksheets with answer keys
  • Smart Question Distribution: Mixed difficulty levels (Easy, Medium, Hard) for comprehensive assessment

🎯 Student Mode

  • Adaptive Quiz System: AI-generated quizzes tailored to uploaded study materials
  • Configurable Sessions: Customize number of questions, difficulty level, and time limits
  • Real-time Feedback: Instant answer validation with explanations
  • Performance Analytics: Track accuracy, weak areas, and learning progress
  • AI Tutor Chat: Interactive Q&A with context-aware responses from uploaded PDFs
  • Enhanced Learning Tools:
    • Mathematical equation solver
    • Function plotting and visualization
    • Automatic follow-up question generation

πŸ”§ Advanced Tools

  • Math Solver: Symbolic equation solving using SymPy
  • Plot Generator: Dynamic function visualization with matplotlib
  • Table Formatter: Clean data presentation
  • Diagram Generator: Flowchart creation for process visualization
  • Vector Store: Qdrant-based document retrieval for contextual responses

πŸ—οΈ Architecture

Technology Stack

Backend

  • Framework: FastAPI (Python)
  • AI/ML:
    • langgraph - Agentic workflow orchestration
    • langchain & langchain-openai - LLM integration
    • google-generativeai - Gemini 2.0 Flash model
    • sentence-transformers - Text embeddings (all-MiniLM-L6-v2)
    • torch - Deep learning framework
  • Vector Database: Qdrant Cloud for document storage and retrieval
  • Document Processing:
    • pypdf - PDF text extraction
    • python-docx - Word document support
    • openpyxl - Excel file handling
    • pandas - Data manipulation

Frontend

  • HTML5 with Jinja2 templating
  • CSS3 with modern aesthetics

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Frontend                              β”‚
β”‚  (HTML/CSS/JS - Templates/Static Files)                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ HTTP/REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     FastAPI Server                           β”‚
β”‚                      (main.py)                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Teacher Endpoints  β”‚  Student Endpoints   β”‚ Chat Endpoint β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                        β”‚                    β”‚
         β–Ό                        β–Ό                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Teacher Agent  β”‚    β”‚  Student Agent     β”‚   β”‚ Chat System  β”‚
β”‚ (LangGraph)    β”‚    β”‚  (LangGraph)       β”‚   β”‚ (RAG-based)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                      β”‚                      β”‚
         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
         β”‚                                             β”‚
         β–Ό                                             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Gemini 2.0     β”‚                          β”‚  Qdrant Vector  β”‚
β”‚  Flash Model    β”‚                          β”‚  Store (Cloud)  β”‚
β”‚  (LLM)          β”‚                          β”‚  (Embeddings)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Advanced Tools Layer                           β”‚
β”‚  β€’ Math Solver    β€’ Plot Generator    β€’ PDF Exporter        β”‚
β”‚  β€’ Table Formatter    β€’ Diagram Generator                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Agent Workflows

Teacher Agent Pipeline

PDF Upload β†’ Extract Text β†’ Segment Topics β†’ Generate MCQs β†’ 
Generate Subjective Questions β†’ Format Worksheet β†’ Export PDF

Student Agent Pipeline

PDF Upload β†’ Extract & Embed β†’ Generate Quiz Questions β†’ 
Present Questions β†’ Validate Answers β†’ Analyze Performance

πŸ“ Project Structure

Demos/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ config.py              # Configuration & API keys
β”‚   β”œβ”€β”€ llm.py                 # Gemini LLM interface
β”‚   β”œβ”€β”€ state.py               # LangGraph state definitions
β”‚   β”œβ”€β”€ teacher_agent.py       # Teacher mode workflow
β”‚   β”œβ”€β”€ student_agent.py       # Student mode workflow
β”‚   β”œβ”€β”€ tools.py               # Advanced tools (math, plots, etc.)
β”‚   └── vector_store.py        # Qdrant vector database interface
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ style.css          # Main application styles
β”‚   β”‚   └── chat.css           # Chat interface styles
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   └── main.js            # Frontend JavaScript
β”‚   └── generated/             # Generated worksheets & outputs
β”‚
β”œβ”€β”€ templates/
β”‚   └── index.html             # Main application template
β”‚
β”œβ”€β”€ temp/                      # Uploaded PDF storage
β”‚
β”œβ”€β”€ main.py                    # FastAPI application entry point
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ .env                       # Environment variables (API keys)
└── README.md                  # This file

πŸš€ Getting Started

Prerequisites

  • Python 3.8+
  • pip (Python package manager)
  • Git (for cloning)

Installation

  1. Clone the repository

    git clone <your-repository-url>
    cd Demos
  2. Create a virtual environment (recommended)

    # Windows
    python -m venv venv
    venv\Scripts\activate
    
    # macOS/Linux
    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    Create a .env file in the project root:

    GEMINI_API_KEY=your_gemini_api_key_here
    QDRANT_URL=your_qdrant_url
    QDRANT_API_KEY=your_qdrant_api_key

    How to get API keys:

  5. Run the application

    python main.py

    The server will start at http://127.0.0.1:8000

  6. Access the application

    Open your browser and navigate to http://127.0.0.1:8000


πŸ“– Usage Guide

Teacher Mode

  1. Upload Study Material

    • Click on "Teacher Mode" in the sidebar
    • Drag & drop a PDF file or click to browse
    • Supported: NCERT chapters, textbooks, reference materials
  2. Configure Worksheet Settings

    • MCQ Count: Choose 10, 20, or 50 questions
    • Difficulty: Select Mixed, Easy, or Hard
    • Options:
      • βœ… Include Subjective Questions
      • βœ… Generate Answer Key
  3. Generate Worksheet

    • Click "Generate Worksheet"
    • Wait for the AI to process (may take 1-2 minutes)
    • Download the generated PDF worksheet and answer key
  4. Output Files

    • Worksheet PDF with all questions
    • Answer key with explanations
    • Markdown version in static/generated/

Student Mode

  1. Upload Study Material

    • Click on "Student Mode" in the sidebar
    • Upload your chapter PDF
  2. Configure Quiz Settings

    • Number of Questions: 5, 10, 15, or 20
    • Difficulty Level: Easy, Medium, or Hard
    • Time Limit: 5-30 minutes
  3. Take the Quiz

    • Click "Start Adaptive Quiz"
    • Answer questions one by one
    • Get instant feedback on each answer
    • View explanations for correct answers
  4. Review Performance

    • See your accuracy score
    • Identify weak areas
    • Review missed questions
  5. Use AI Tutor Chat

    • After uploading a PDF, the chat interface becomes available
    • Ask questions about the content
    • Get contextual answers with follow-up suggestions
    • Request math solutions, plots, or explanations

AI Chat Features

Example Queries:

  • "Explain the concept of photosynthesis"
  • "Solve the equation: x^2 - 5x + 6 = 0"
  • "Plot the function: sin(x) + cos(x)"
  • "Compare mitochondria and chloroplasts in a table"
  • "Show me the steps for cellular respiration"

πŸ”§ API Endpoints

Public Endpoints

Endpoint Method Description
/ GET Main application interface
/api/upload POST Upload PDF file
/api/generate-worksheet POST Generate worksheet (Teacher Mode)
/api/student/start POST Start quiz session (Student Mode)
/api/student/submit-answer POST Submit answer and get validation
/api/student/finish-quiz POST Complete quiz and get results
/api/chat POST Chat with AI tutor

Request Examples

Upload File:

curl -X POST "http://127.0.0.1:8000/api/upload" \
  -F "file=@chapter.pdf"

Generate Worksheet:

curl -X POST "http://127.0.0.1:8000/api/generate-worksheet" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "chapter.pdf",
    "mcq_count": 10
  }'

Chat Query:

curl -X POST "http://127.0.0.1:8000/api/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Explain Newton's laws",
    "filename": "physics.pdf"
  }'

πŸ§ͺ Advanced Features

Mathematical Problem Solving

The system can solve equations and evaluate expressions:

# Automatically triggered when queries contain math keywords
Query: "Solve x^2 - 4 = 0"
Response: Solutions: [2, -2]

Function Plotting

Visualize mathematical functions:

Query: "Plot x^2 + 2*x + 1"
# Generates a graph with proper axes and grid

Intelligent Follow-ups

After each answer, the AI generates 3 follow-up questions to deepen understanding:

Answer: [Your Answer]

Follow-up Questions:
1. How does this concept relate to...?
2. Can you explain the practical application of...?
3. What would happen if...?

πŸ” Security & Configuration

Environment Variables

Variable Description Required
GEMINI_API_KEY Google Gemini API key βœ… Yes
QDRANT_URL Qdrant cloud instance URL βœ… Yes
QDRANT_API_KEY Qdrant authentication key βœ… Yes

Security Best Practices

  1. Never commit .env file to version control
  2. Use environment-specific configurations for development/production
  3. Rotate API keys regularly
  4. Implement rate limiting for production deployments
  5. Sanitize file uploads to prevent malicious files

🎨 Customization

Changing the AI Model

Edit backend/config.py:

GEMINI_MODEL_NAME = "gemini-2.0-flash"  # Change to desired model

Adjusting Question Generation

Modify prompts in:

  • backend/teacher_agent.py - Worksheet generation
  • backend/student_agent.py - Quiz generation

Customizing UI Theme

Edit static/css/style.css to change:

  • Color scheme
  • Typography
  • Layout and spacing
  • Animations

πŸ› Troubleshooting

Common Issues

Issue: "Error reading PDF content"

  • Solution: Ensure the PDF is not password-protected and contains extractable text

Issue: "Connection to Qdrant failed"

  • Solution: Verify QDRANT_URL and QDRANT_API_KEY in .env file

Issue: "Gemini API rate limit exceeded"

  • Solution: Wait a few minutes or upgrade your API quota

Issue: "Torch/CUDA errors"

  • Solution: CPU-only mode is sufficient. Install with: pip install torch --index-url https://download.pytorch.org/whl/cpu

Issue: "Module not found"

  • Solution: Reinstall dependencies: pip install -r requirements.txt

πŸ“Š Performance Optimization

For Large PDFs

  • PDFs are chunked into smaller segments for better processing
  • Vector embeddings are cached in Qdrant
  • Consider splitting very large documents (>100 pages)

For Faster Response Times

  • Use a local Qdrant instance instead of cloud
  • Enable GPU acceleration for torch if available
  • Increase API rate limits

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guide for Python code
  • Add docstrings to all functions
  • Test thoroughly before submitting
  • Update documentation for new features

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Google Gemini AI for powerful language model capabilities
  • LangChain & LangGraph for agentic workflow framework
  • Qdrant for vector database infrastructure
  • FastAPI for modern web framework
  • Open source community for various tools and libraries

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors