vashundhara410-creator/rag-classroom-assistant

Python

0

2 commits

updated Sep 4, 2026

See the code

README

ECE Classroom Assistant — RAG-Based Domain-Specific QA System

A Dynamic Domain-Specific Classroom Assistant built using Retrieval-Augmented Generation (RAG) architecture. Designed for Electronics and Communication Engineering (ECE) departments to query student records and academic documents using natural language.


Project Overview

Traditional LLMs generate responses from generalized training data and often hallucinate. This system solves that by grounding every answer strictly in uploaded classroom documents — student records, syllabi, and subject notes.

Key capabilities:

  • Answer student-specific queries from uploaded CSV records
  • Retrieve subject knowledge from uploaded ECE PDF documents
  • Reject out-of-domain queries with a controlled response
  • Dynamically update knowledge base without retraining the model

System Architecture

User Query
    ↓
Embedding Model (all-MiniLM-L6-v2)
    ↓
Vector Similarity Search (ChromaDB)
    ↓
Top-K Relevant Chunks Retrieved
    ↓
Prompt Construction (query + context)
    ↓
LLM Response Generation (phi3:mini via Ollama)
    ↓
Grounded Answer → User

Tech Stack

ComponentTechnology
LanguagePython 3.10+
LLMphi3:mini via Ollama (local)
Embedding Modelall-MiniLM-L6-v2 (sentence-transformers)
Vector DatabaseChromaDB (persistent local store)
RAG FrameworkLangChain
Frontend UIStreamlit
Document ParsingPyPDF, Pandas
Environmentpython-dotenv

Project Structure

rag_classroom_assistant/
├── app.py                  # Streamlit chat UI
├── requirements.txt        # All dependencies
├── .env                    # Environment config
├── verify_setup.py         # Setup checker
│
├── src/
│   ├── ingest.py           # Document ingestion + chunking
│   ├── embed.py            # Embedding generation + ChromaDB storage
│   └── rag_pipeline.py     # Query → retrieve → LLM → answer
│
├── data/
│   ├── documents/          # ECE PDFs (syllabus, notes)
│   └── students/           # Student records (CSV)
│
└── db/
    ├── chunks.json         # Processed text chunks
    └── chroma_store/       # ChromaDB vector index

Setup Instructions

1. Clone / download the project

cd Desktop
# place the rag_classroom_assistant folder here

2. Create and activate virtual environment

python -m venv venv
venv\Scripts\activate        # Windows

3. Install dependencies

pip install -r requirements.txt

4. Install Ollama and pull model

Download Ollama from https://ollama.com then:

ollama pull phi3:mini

5. Add your documents

  • Place ECE PDFs in data/documents/
  • Place student CSV in data/students/

6. Run ingestion and embedding

python src\ingest.py
python src\embed.py

7. Launch the app

streamlit run app.py

Usage

Open http://localhost:8501 in your browser and start asking questions:

Student queries:

  • "What are Priya's marks in VLSI Design?"
  • "Who scored the highest in Digital Signal Processing?"
  • "List students with attendance below 80%"

Subject queries (requires PDFs uploaded):

  • "What is the syllabus for Microprocessors?"
  • "Explain the topics covered in VLSI Design unit 2"

Out-of-domain (correctly rejected):

  • "What is the capital of France?" → "This information is not available in the uploaded documents."

How RAG Works (for interviews)

  1. Ingestion — Documents are read and split into 500-word overlapping chunks
  2. Embedding — Each chunk is converted to a 384-dimensional vector using sentence-transformers
  3. Storage — Vectors are stored in ChromaDB with cosine similarity indexing
  4. Retrieval — User query is embedded and top-3 most similar chunks are fetched
  5. Generation — Retrieved chunks + query are sent to phi3:mini as a structured prompt
  6. Domain restriction — If similarity score < 0.30, query is rejected as out-of-domain

Why RAG over plain LLM?

FeaturePlain LLMRAG System
HallucinationHighVery low
Domain restrictionNot possibleBuilt-in
Private data supportNoYes
Dynamic updatesNeeds retrainingUpload + re-index
Answer traceabilityNoneSource chunks shown

Future Enhancements

  • Add multi-language support (Tamil, Hindi)
  • Integrate with college ERP system for live student data
  • Add voice input support
  • Deploy on cloud (AWS / Azure) for department-wide access
  • Add answer confidence scores visible to the user

Author

Vashundhara.R — Pre-final year ECE Student
Project: AIML mini Project
Domain: AI / NLP / Information Retrieval

vashundhara410-creator/rag-classroom-assistant

Python

0

2 commits

updated Sep 4, 2026

See the code

README

ECE Classroom Assistant — RAG-Based Domain-Specific QA System

A Dynamic Domain-Specific Classroom Assistant built using Retrieval-Augmented Generation (RAG) architecture. Designed for Electronics and Communication Engineering (ECE) departments to query student records and academic documents using natural language.


Project Overview

Traditional LLMs generate responses from generalized training data and often hallucinate. This system solves that by grounding every answer strictly in uploaded classroom documents — student records, syllabi, and subject notes.

Key capabilities:

  • Answer student-specific queries from uploaded CSV records
  • Retrieve subject knowledge from uploaded ECE PDF documents
  • Reject out-of-domain queries with a controlled response
  • Dynamically update knowledge base without retraining the model

System Architecture

User Query
    ↓
Embedding Model (all-MiniLM-L6-v2)
    ↓
Vector Similarity Search (ChromaDB)
    ↓
Top-K Relevant Chunks Retrieved
    ↓
Prompt Construction (query + context)
    ↓
LLM Response Generation (phi3:mini via Ollama)
    ↓
Grounded Answer → User

Tech Stack

ComponentTechnology
LanguagePython 3.10+
LLMphi3:mini via Ollama (local)
Embedding Modelall-MiniLM-L6-v2 (sentence-transformers)
Vector DatabaseChromaDB (persistent local store)
RAG FrameworkLangChain
Frontend UIStreamlit
Document ParsingPyPDF, Pandas
Environmentpython-dotenv

Project Structure

rag_classroom_assistant/
├── app.py                  # Streamlit chat UI
├── requirements.txt        # All dependencies
├── .env                    # Environment config
├── verify_setup.py         # Setup checker
│
├── src/
│   ├── ingest.py           # Document ingestion + chunking
│   ├── embed.py            # Embedding generation + ChromaDB storage
│   └── rag_pipeline.py     # Query → retrieve → LLM → answer
│
├── data/
│   ├── documents/          # ECE PDFs (syllabus, notes)
│   └── students/           # Student records (CSV)
│
└── db/
    ├── chunks.json         # Processed text chunks
    └── chroma_store/       # ChromaDB vector index

Setup Instructions

1. Clone / download the project

cd Desktop
# place the rag_classroom_assistant folder here

2. Create and activate virtual environment

python -m venv venv
venv\Scripts\activate        # Windows

3. Install dependencies

pip install -r requirements.txt

4. Install Ollama and pull model

Download Ollama from https://ollama.com then:

ollama pull phi3:mini

5. Add your documents

  • Place ECE PDFs in data/documents/
  • Place student CSV in data/students/

6. Run ingestion and embedding

python src\ingest.py
python src\embed.py

7. Launch the app

streamlit run app.py

Usage

Open http://localhost:8501 in your browser and start asking questions:

Student queries:

  • "What are Priya's marks in VLSI Design?"
  • "Who scored the highest in Digital Signal Processing?"
  • "List students with attendance below 80%"

Subject queries (requires PDFs uploaded):

  • "What is the syllabus for Microprocessors?"
  • "Explain the topics covered in VLSI Design unit 2"

Out-of-domain (correctly rejected):

  • "What is the capital of France?" → "This information is not available in the uploaded documents."

How RAG Works (for interviews)

  1. Ingestion — Documents are read and split into 500-word overlapping chunks
  2. Embedding — Each chunk is converted to a 384-dimensional vector using sentence-transformers
  3. Storage — Vectors are stored in ChromaDB with cosine similarity indexing
  4. Retrieval — User query is embedded and top-3 most similar chunks are fetched
  5. Generation — Retrieved chunks + query are sent to phi3:mini as a structured prompt
  6. Domain restriction — If similarity score < 0.30, query is rejected as out-of-domain

Why RAG over plain LLM?

FeaturePlain LLMRAG System
HallucinationHighVery low
Domain restrictionNot possibleBuilt-in
Private data supportNoYes
Dynamic updatesNeeds retrainingUpload + re-index
Answer traceabilityNoneSource chunks shown

Future Enhancements

  • Add multi-language support (Tamil, Hindi)
  • Integrate with college ERP system for live student data
  • Add voice input support
  • Deploy on cloud (AWS / Azure) for department-wide access
  • Add answer confidence scores visible to the user

Author

Vashundhara.R — Pre-final year ECE Student
Project: AIML mini Project
Domain: AI / NLP / Information Retrieval