Skip to content

Repository files navigation

📚 Study Assistant & Quiz Generator — LangChain

Python LangChain OpenAI Open In Colab License: MIT

LangChain SequentialChain pipeline — loads a PDF, summarizes to bullet points, then auto-generates 5 MCQ quiz questions. No vector DB required.

🎓 Part of the Analytics Vidhya GenAI Pinnacle Plus Program


📋 Overview

A two-stage LangChain pipeline where Chain 1 summarizes study material and Chain 2 generates quiz questions from that summary. Demonstrates the SequentialChain pattern — the output of one LLM chain automatically feeds the next.


🛠️ Tech Stack

Layer Technology
LLM Orchestration LangChain (LLMChain, SequentialChain, PromptTemplate)
LLM OpenAI GPT-3.5-turbo
PDF Parsing PyPDF2

📁 Project Structure

6th langchain agentic AI/
├── study_assistant_quiz_generator.ipynb  ← Main notebook
├── Prompt Engineering.pdf                ← Sample study material
└── README.md

⚙️ Prerequisites

pip install PyPDF2 langchain langchain-openai openai

Set your OpenAI API key:

os.environ["OPENAI_API_KEY"] = "sk-..."

🚀 Pipeline Architecture

PDF file
    ↓ PyPDF2 (extract text, truncate to 4000 chars)
    ↓
Chain 1 — SummaryChain
    LLM role: "expert educator"
    Output: 5-8 bullet-point summary
    ↓
Chain 2 — QuizChain
    LLM role: "expert quiz creator"
    Output: 5 MCQs (a/b/c/d + correct answer)

Orchestrator: SequentialChain (verbose=True)

🧪 Sample Output

Summary:

  • Prompt engineering refines inputs to language models for better output control.
  • Zero-shot prompting uses general knowledge without task-specific examples.
  • Few-shot prompting provides examples to guide model performance.
  • Chain-of-Thought breaks complex tasks into intermediate reasoning steps.

Quiz Question:

1. Which technique provides examples to guide model output?
   a) Zero-shot prompting
   b) Few-shot prompting  ✓
   c) Chain-of-Thought
   d) Role playing

💡 Key Learnings

  • PromptTemplate — parameterized prompt construction with input_variables
  • LLMChain — bind a prompt to an LLM and give the output a key
  • SequentialChain — pipe multiple chains where output of one = input of next
  • output_key — controls how results flow between chains
  • Context window management — truncating PDF text to 4,000 chars

🎓 Program Context

This project is Assignment 6 of the Analytics Vidhya GenAI Pinnacle Plus Program — LangChain Agentic AI module, first LLM orchestration project.


📄 License

MIT © 2026 sujitchan431

About

PDF → LLM summary → MCQ quiz generator via LangChain SequentialChain | AV GenAI Pinnacle Plus

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages