Skip to content

kalviumcommunity/Smart-Study-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

41 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Smart Study Assistant โ€” AI Tutor with Zero-Shot Prompting, RAG & Function Calling

A personalized AI-powered tutor that intelligently adapts to any question using Zero-Shot Prompting, Retrieval-Augmented Generation (RAG), and Function Calling. This assistant helps students study smarter by automatically optimizing AI responses for different subjects and learning contexts.

โœจ Built for BTech prep, competitive exams, and lifelong learners with intelligent prompt adaptation.


๐Ÿš€ Features

Feature Description
๐ŸŽฏ Zero-Shot Prompting Automatically detects question type (math, science, history, etc.) and optimizes AI responses accordingly.
๐Ÿ” Question Answering (RAG) Ask questions from uploaded notes or PDFs. Get AI-generated answers grounded in source content.
๐Ÿงพ Summarization Upload documents and get key-point summaries for revision.
๐ŸŽ“ Flashcard Generator Auto-generate Q&A flashcards for active recall and spaced repetition.
๐Ÿ“‹ Quiz Generator (MCQs) Convert study material into quizzes with correct options and distractors.
โฐ Reminder Scheduler Schedule study sessions or revision reminders using natural language.
๐Ÿง  Adaptive Prompting Subject-specific prompts with difficulty levels (beginner/intermediate/advanced).

๐Ÿง  Tech Stack

Layer Tools Used
โš™๏ธ Backend Node.js, Express.js, JavaScript (ES Modules)
๐Ÿ“„ Document Parsing JavaScript parsing utilities
๐Ÿง  Language Model Google Gemini API (@google/genai)
๐Ÿ” Vector DB In-memory context management
๐ŸŽฏ Structured Output JSON schemas for flashcards, summaries, quizzes
๐Ÿง  Function Calling Reminder APIs, quiz generation, schedule builder
๐ŸŒ Frontend (optional) React.js + Tailwind CSS or Postman/Bruno for API demo
๐Ÿ”ง Prompting Strategies Zero-Shot, One-Shot, Multi-Shot, Chain-of-Thought

๐Ÿ—๏ธ Architecture

graph TD
    A["User Input (Text or Voice)"] --> B["Prompt + Notes"]
    B --> C["Retrieval Engine (RAG)"]
    C --> D["LLM (GPT-4 with Function Calling)"]
    D --> E{"Structured Output?"}
    E -->|Flashcards| F["Flashcard JSON"]
    E -->|Quiz| G["Quiz JSON"]
    E -->|Answer| H["Text Output"]
    D --> I["Call Reminder API"]
    F & G & H --> J["Frontend / API Response"]
Loading

โœจ Sample Use Cases

๐Ÿ—‚๏ธ Upload syllabus or PDF notes, then try:

๐Ÿ”น Question Answering

"Explain Newton's Second Law with examples from my uploaded physics notes."

๐Ÿ”น Flashcard Generation

"Generate 5 flashcards for the photosynthesis topic in my biology.pdf."

๐Ÿ”น Quiz Generation

"Create a quiz with 5 MCQs from the chapter on Semiconductor Devices."

๐Ÿ”น Zero-Shot Prompting (NEW!)

# Automatic subject detection and optimization
"Solve 2x + 5 = 15"  # โ†’ Detects math, shows step-by-step solution
"What is photosynthesis?"  # โ†’ Detects science, provides detailed explanation with examples
"When did World War I start?"  # โ†’ Detects history, gives chronological context

# Manual control with options
node zero-shot.js --type math --level beginner "Explain derivatives"
node zero-shot.js --task tutorial "How to solve quadratic equations"

๐Ÿ”น Reminder Scheduling (Function Calling)

"Remind me to revise Operating Systems every Monday at 7 PM."

โš™๏ธ How It Works (Behind the Scenes)

  1. Upload Document / Notes
    PDF, Markdown, or plain text is parsed and chunked for embedding.

  2. Vector Store Creation
    Notes are embedded and stored in a vector DB (e.g., Chroma).

  3. RAG Pipeline
    On user query, relevant chunks are retrieved and passed into the LLM.

  4. Prompting + Role Instructions
    Prompts are engineered to elicit tutor-like answers, summaries, or flashcards.

  5. Structured Output
    JSON schema (with tool calling or OpenAI function calling) enables:

    • Reminders (via API)
    • Flashcard/Quiz output
    • Visual rendering on frontend

๐Ÿ› ๏ธ Setup Instructions

1. Clone the repo

git clone https://github.com/kalviumcommunity/Smart-Study-Assistant.git
cd smart-study-assistant

2. Install dependencies

npm install
# or if using Python-based document processing
pip install -r requirements.txt

3. Set up environment variables

Create .env and add:


4. Run backend server

npm run dev

5. Upload PDFs & Test

Use Postman or frontend UI to upload a file and ask questions.


๐Ÿงช API Examples

POST /ask-question

{
  "query": "What is Ohm's Law?",
  "documentId": "physics-notes"
}

POST /generate-flashcards

{
  "topic": "Photosynthesis",
  "documentId": "bio.pdf"
}

POST /schedule-reminder

{
  "reminder": "Revise DSA on weekends",
  "time": "Saturday 6 PM"
}

๐Ÿš€ Quick Start - Zero-Shot Prompting

Command Line Usage

# Navigate to backend directory
cd backend

# Basic usage (automatic detection)
node zero-shot.js "What is photosynthesis?"
node zero-shot.js "Solve 3x + 7 = 22"

# With specific options
node zero-shot.js --type math --level beginner "Explain calculus"
node zero-shot.js --task tutorial "How to write Python functions"

# See all available options
node zero-shot.js --types
node zero-shot.js --help

# Run demonstration
node demo-zero-shot.js

API Usage

# Standard chat with zero-shot prompting
curl -X POST http://localhost:3000/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Solve 2x + 5 = 15", "options": {"promptType": "math"}}'

# Advanced zero-shot endpoint
curl -X POST http://localhost:3000/chat/zero-shot \
  -H "Content-Type: application/json" \
  -d '{"message": "Explain machine learning", "promptType": "programming", "level": "intermediate"}'

# Get available prompt types
curl http://localhost:3000/chat/types

๐Ÿงฐ Prompt Engineering Examples

System Prompt:

You are a friendly and helpful tutor for engineering students. You answer using the uploaded study notes only. Keep explanations concise and exam-focused.

User Prompt:

Based on my Operating Systems notes, explain multithreading with examples.

Output Format (Structured):

{
  "topic": "Multithreading",
  "explanation": "Multithreading allows multiple threads to run concurrently...",
  "examples": ["Thread A for UI", "Thread B for I/O operations"]
}

๐Ÿง  RAG Setup

  • Load document using LangChain / LlamaIndex
  • Split into chunks (~500 tokens)
  • Embed using OpenAI Embeddings
  • Store in FAISS/Chroma vector store
  • Query = Embed + Similarity search + Prompt injection

๐Ÿ’ก Future Features

  • ๐Ÿ—ฃ๏ธ Voice Interaction via Whisper + TTS
  • ๐Ÿ“š Notion/Obsidian integration
  • ๐Ÿ“ฑ Mobile version in React Native
  • ๐Ÿ“Š Analytics Dashboard for user performance
  • ๐ŸŽฎ Gamification with rewards & leaderboards

๐Ÿ‘จโ€๐Ÿ’ป Author

Chethan Regala
Second year BTech Student(Kalvium) | Passionate about Generative AI, Full Stack, and Building Scalable Products
๐Ÿ“ง chethanregala123@gmail.com
๐Ÿ”— LinkedIn | GitHub


About

An AI-powered study assistant that turns your notes into instant answers, flashcards, and quizzes using RAG and function calling.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages