Skip to content

Commit 87a133d

Browse files
committed
Readme template
1 parent 83d39dd commit 87a133d

File tree

1 file changed

+31
-37
lines changed

1 file changed

+31
-37
lines changed

llm_quiz_generator/README.md

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
# Automated Quiz Generator from PDF Files
22

3-
This Python script automates the process of generating Multiple Choice Questions (MCQs) from the content of PDF files stored in a folder. The script extracts the text from the PDFs, generates unique questions with four answer options using a language model (LLM), and saves the quiz as a text file. This is useful for creating quizzes from educational or study material.
4-
5-
## Features
3+
This Python script automates the process of generating Multiple Choice Questions (MCQs) from the content of PDF files stored in a folder. It extracts the text from the PDFs, generates unique questions with four answer options using a language model (LLM), and saves the quiz as a text file.
64

75
- **Automatic PDF Text Extraction**: Extracts text from all PDFs in a specified folder.
86
- **MCQ Generation**: Generates unique multiple choice questions with 4 answer options and identifies the correct answer.
97
- **Quiz Output**: Saves the quiz in a text format for easy review.
108

11-
## Requirements
12-
13-
The following Python packages are required to run the script:
14-
- PyPDF2
15-
- langchain
16-
- langchain_groq
17-
- langchain_community
18-
- langchain_huggingface
19-
- faiss-cpu
20-
21-
---
22-
23-
## How to Use the Automated Quiz Generator Script
9+
## Setup Instructions
2410

2511
This guide will walk you through the steps to set up and run the Automated Quiz Generator, which converts PDF content into multiple-choice questions (MCQs). You will need to create an account with Groq to get an API key and set up your Python environment before running the script.
2612

27-
2813
### Step 1: Create a Groq Account and Get an API Key (100% free)
2914

3015
1. **Visit Groq's Console**:
@@ -44,59 +29,68 @@ This guide will walk you through the steps to set up and run the Automated Quiz
4429

4530
---
4631

47-
### **Step 2: Add Your API Key to the Script**
48-
49-
You have two options to use your API key. We recommend using the method 1 since, storing API keys directly in your code is risky because it exposes sensitive information, especially if you share or push your code to platforms like GitHub. Using a `.env` file is a safer approach because it keeps your keys private and separate from the code. It also prevents accidental exposure by ensuring the keys aren't included in version control systems like Git. This method enhances security and protects your application from unauthorized access.
32+
### Step 2: Add Your API Key to the Script
5033

34+
You have two options to use your API key. We recommend using option 1 since storing API keys directly in your code is risky because it exposes sensitive information, especially if you share or push your code to platforms like GitHub. Using a `.env` file is a safer approach because it keeps your keys private and separate from the code. It also prevents accidental exposure by ensuring the keys aren't included in version control systems like Git. This method enhances security and protects your application from unauthorized access.
5135

52-
53-
#### **Option 1: Store the API Key in a `.env` File**
36+
#### Option 1: Store the API Key in a `.env` File
5437

5538
1. Create a new file in the same directory as your script and name it `.env`.
5639
2. Open the `.env` file in a text editor.
57-
3. Add the following line to the `.env` file, replacing your_groq_api_key_here with your actual API key:
40+
3. Add the following line to the `.env` file, replacing `your_groq_api_key_here` with your actual API key:
5841
```
59-
GROQ_API_KEY=your_groq_api_key_here
42+
GROQ_API_KEY="your_groq_api_key_here"
6043
```
61-
4. Save the `.env` file
44+
4. Save the `.env` file.
6245

63-
#### **Option 2: Paste the API Key Directly into the Script**
46+
#### Option 2: Paste the API Key Directly into the Script
6447

6548
1. Open the `main.py` file in your code editor.
6649
2. Find the following line in the script (around line 38):
67-
```python
68-
API_KEY = os.environ["GROQ_API_KEY"]
69-
```
50+
```python
51+
API_KEY = os.environ["GROQ_API_KEY"]
52+
```
7053
3. Replace the above line with your API key directly, like this:
71-
```python
72-
API_KEY = "your_groq_api_key_here"
73-
```
54+
```python
55+
API_KEY = "your_groq_api_key_here"
56+
```
7457

7558
---
7659

77-
### Step 3: Prepare the PDF files
60+
### Step 3: Prepare the PDF Files
61+
7862
1. Create a folder (if not present) called `Source` in the same directory as your Python script.
7963
2. Place all the PDF files that you want to generate quizzes from inside the `Source` folder.
8064

8165
---
8266

8367
### Step 4: Install the Dependencies
68+
8469
1. Install all the required modules using this command:
8570
```
8671
pip install -r requirements.txt
8772
```
8873

89-
9074
---
9175

9276
### Step 5: Run the Script
77+
9378
1. To generate the quiz, open a terminal or command prompt in the folder where the script is located and run the following command:
9479
```
9580
python main.py
9681
```
97-
This will extract the text from the PDFs, generate multiple-choice questions (MCQs) using the language model, and save the output the folder named `Source`.
82+
This will extract the text from the PDFs, generate multiple-choice questions (MCQs) using the language model, and save the output in a folder named `Generated_Quizes`.
9883

9984
---
10085

101-
## Rate Limits and Troubleshooting
102-
Please note that the free tier of Groq API has rate limits, which may cause errors if too many requests are made in a short period of time. If you encounter a rate limit error, try reducing the number of PDFs in the 'Source' folder or lower the number of questions being generated. This should help avoid hitting the rate limits. For more information on the exact rate limits, please refer to the [Groq API documentation](https://console.groq.com/settings/limits).
86+
## Output
87+
88+
The generated MCQ quiz will be saved in a text file with a timestamp in the `Generated_Quizes` folder. Each question will have four options, and the correct answer will be indicated.
89+
90+
## Author(s)
91+
92+
[Naman Verma](https://github.com/NamanVer02/)
93+
94+
## Disclaimers
95+
96+
Please note that the free tier of Groq API has rate limits, which may cause errors if too many requests are made in a short period of time. If you encounter a rate limit error, try reducing the number of PDFs in the 'Source' folder or lower the number of questions being generated. This should help avoid hitting the rate limits. For more information on the exact rate limits, please refer to the [Groq API documentation](https://console.groq.com/settings/limits).

0 commit comments

Comments
 (0)