Skip to content

I recently built a powerful tool that leverages the capabilities of LLMs and LangChain to automatically generate Multiple Choice Questions (MCQs) from any uploaded document — making content creation easier for educators, trainers, and exam designers.

Notifications You must be signed in to change notification settings

Narendra8767/MCQ-Generator-Using-LangChain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Built an AI-Powered MCQ Generator Using LangChain + OpenAI API
I recently built a powerful tool that leverages the capabilities of LLMs and LangChain to automatically generate Multiple Choice Questions (MCQs) from any uploaded document — making content creation easier for educators, trainers, and exam designers. 📚🤖

image alt

image

image

🛠️ Tech Stack: LangChain – for prompt templating and OpenAI model interaction
OpenAI GPT-4 API – for natural language generation
Flask – to build the web interface
pdfplumber, python-docx – for extracting text from PDFs and DOCX files
FPDF – for generating downloadable PDF quiz files

📈 Project Workflow:
1️⃣ File Upload
Users can upload .pdf, .docx, or .txt files through a simple web interface.
2️⃣ Text Extraction
The backend parses the document and extracts clean, structured text using file-type specific libraries.
3️⃣ MCQ Generation (LLM + LangChain)
A custom LangChain prompt is used to instruct GPT-4 to:
Generate clear, relevant questions
Provide four answer options
Indicate the correct answer explicitly
Users can choose how many questions to generate (num_questions input).
4️⃣ Results Display + Export
The MCQs are:
Displayed on-screen for review
Saved as .txt and .pdf for easy download
Made accessible via a one-click download link

📦 Docker Integration:
To ensure easy deployment and platform independence, I containerized the entire MCQ Generator application using Docker. This allows anyone to run the project in seconds without worrying about environment setup or dependency issues.

✅ Benefits:
One-command deployment
Works across any OS with Docker
No need to manually install Python libraries
Ideal for demos, workshops, or classroom tools

🐳 Public Docker Image:
You can pull and run it directly from Docker Hub:
🔗 https://hub.docker.com/repository/docker/narendratekale49/mcq-generator/general

About

I recently built a powerful tool that leverages the capabilities of LLMs and LangChain to automatically generate Multiple Choice Questions (MCQs) from any uploaded document — making content creation easier for educators, trainers, and exam designers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published