Skip to content

The MCQ Generator uses OpenAI and LangChain to create multiple-choice questions from a provided PDF, allowing users to specify the subject and difficulty level.

License

Notifications You must be signed in to change notification settings

Gaurav-Jaiswal-1/MCQ-Generator-Using-Langchain-and-OpenAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCQ Generator Using OpenAI and LangChain

Welcome to the MCQ Generator repository! This project harnesses the capabilities of OpenAI's language models and the LangChain framework to generate multiple-choice questions (MCQs) from any topic provided as a PDF file. The tool is designed to assist educators, students, and content creators by automating the creation of MCQs, ensuring a wide range of subjects and difficulty levels can be catered to.

Features

  • PDF Input Support: Upload a PDF file containing content on any topic, and the generator will extract relevant information to create questions.
  • Subject-Specific Questions: Specify the subject of interest, and the tool will focus on generating questions relevant to that topic.
  • Adjustable Difficulty Levels: Set the tone for the desired difficulty level, ranging from easy to challenging, to match the target audience's needs.
  • High-Quality MCQs: Utilize OpenAI's advanced language models to produce well-structured questions and plausible answer choices.
  • Seamless Integration with LangChain: Leverage LangChain's framework to streamline the question generation process, ensuring clarity and relevance.

Getting Started

Follow these steps to get started with the MCQ Generator:

  1. Clone the Repository:

    git clone https://github.com/Gaurav-Jaiswal-1/MCQ-Generator-Using-Langchain-and-OpenAI.git
    cd mcq-generator
  2. Install Dependencies: Ensure you have Python installed, then install the required packages:

    pip install -r requirements.txt
  3. Set Up OpenAI API Key: You'll need an OpenAI API key to access the language models. Set your API key as an environment variable or include it in the configuration file.

  4. Run the Generator: Use the provided script to generate MCQs:

    python generate_mcqs.py --input_file "path/to/your.pdf" --subject "Biology" --difficulty "medium"

Customization and Usage

  • Customizable Input: The tool accepts any PDF file as input, making it versatile for different content types.
  • Subject and Difficulty Specification: Users can specify the subject area and difficulty level to tailor the MCQs to their needs.
  • Output Formats: The generated questions can be output in various formats, including JSON, CSV, or plain text, suitable for integration into educational platforms or quizzes.

Contributing

We welcome contributions to enhance the MCQ Generator! If you have suggestions for new features, improvements, or bug fixes, please open an issue or submit a pull request.

License

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

Acknowledgments

Special thanks to OpenAI for their language models and to the LangChain contributors for facilitating efficient language processing.


''' To create virtual environment use

  • conda create -p env python=3.11.4 -y or
  • python -m venv env

To activate virtual environment use

  • .\env\Scripts\activate '''

''' write your requirements in requirements.txt file and run -

  • pip install -r requirements.txt '''

''' To check all the libraries use -

  • pip list '''

''' If you have any issues with kernels for jupyter notebook use -

  • pip install ipykernel '''

''' For Github

  • git clone (github repo link to clone )

  • git init # If you are not cloning

  • git config --global user.name "Your Name"

  • git config --global user.email "[email protected]"

  • git add .

  • git commit -m "Message" # Message is mandatory(type any message you want)

  • git branch -M main

  • git remote add origin https:/(your git hub repo link)

  • git push -f origin main

  • git status # to check the current status

    To remove directory from github repo

    • git rm -r --cached (file or directory name that you want to remove)

'''

If you're having large files issue to push on github use -

- git checkout --orphan latest_branch
- git add -A
- git commit -am "Commit Message"
- git branch -D main
- git push origin main

About

The MCQ Generator uses OpenAI and LangChain to create multiple-choice questions from a provided PDF, allowing users to specify the subject and difficulty level.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published