Skip to content

Generate MCQs with choices and correct answer in JSON Format. Uses GPT3.5.

License

Notifications You must be signed in to change notification settings

55abhilash/mcqgen

Repository files navigation

mcqgen

License: MIT Python Version

Generate MCQs with options and correct answers in JSON Format. Uses GPT.

Installation

You can install the package using pip:

pip install mcqgen

Make sure you have OpenAI key stored in environment variable OPENAI_API_KEY

Usage

Simply call function generate_mcqs as below. First argument (Topic) is mandatory. Default Model (model) is GPT3.5 and default number of questions (no) is 5.

from mcqgen import mcqgen
gen = mcqgen.MCQGenerator()
data = gen.generate_mcqs('Cricket', model="gpt-3.5-turbo", no=3)
print(data)
{'questions': [{'question': 'Who holds the record for the highest individual score in Test cricket?', 'options': ['a) Sachin Tendulkar', 'b) Brian Lara', 'c) Don Bradman', 'd) Ricky Ponting'], 'answer': 'b) Brian Lara'}, {'question': 'Which cricketer has scored the most centuries in One Day Internationals (ODIs)?', 'options': ['a) Sachin Tendulkar', 'b) Ricky 
Ponting', 'c) Virat Kohli', 'd) Kumar Sangakkara'], 'answer': 'a) Sachin Tendulkar'}, {'question': 'Who has the best bowling figures in a Test innings?', 'options': ['a) Jim Laker', 'b) Anil Kumble', 'c) Muttiah Muralitharan', 'd) Shaun Pollock'], 'answer': 'a) Jim Laker'}]}

About

Generate MCQs with choices and correct answer in JSON Format. Uses GPT3.5.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages