Build or develop a quiz bot based on a network security course using the open-source alternatives to ChatGPT that can be run on any local machine. As data privacy can be compromised when sending data over the internet, it is mandatory to keep it on local system. The bot offers two types of questions: randomly generated questions and specific topic questions, the answers should be pulled from the network security database. The bot is trained using network security quizzes, lecture slides, network security textbook. The quiz includes multiple-choice questions, true/false questions, and open-ended questions. Finally, the bot will provide feedback on the user's answers if it is correct or not along with the reference source documentation title.
The user enters a prompt in the user interface. The system converts user queries into numerical embeddings, capturing the meaning of the text. The application sends the generated embedding to the vector database.
The vector database compares the user's embedding with precomputed embeddings of various documents.
It returns a list of documents that are most relevant to the user's prompt based on the similarity of their embeddings to the user's embedding. The application creates a new prompt by combining the user's initial prompt with the retrieved documents as context.
This step aims to provide additional information and context to the local Language Model. The modified prompt, containing both the user's input and relevant context documents, is sent to the local Language Model (LLM).
The LLM processes the contextual prompt and generates a response based on the combined information.
The response includes citations or references from the context documents, demonstrating the sources used to generate the answer. The system presents the response along with citations in the user interface.
Users can view the answer and sources, ensuring transparency and credibility in the information provided.
QuizBot_Video.mp4
Create virtual environment
python3 -m venv venv
./venv/bin/activate - for MAC users
./venv/Scripts/activate - for WINDOWS users
*pip install langchain==0.0.274
*pip install gpt4all==1.0.8
*pip install chromadb==0.4.7
*pip install llama-cpp-python==0.1.81
*pip install urllib3==2.0.4
*pip install PyMuPDF==1.23.1
*pip install python-dotenv==1.0.0
*pip install unstructured==0.10.8
*pip install extract-msg==0.45.0
*pip install tabulate==0.9.0
*pip install pandoc==2.3
*pip install pypandoc==1.11
*pip install pypdfcd
*pip install tqdm==4.66.1
*pip install sentence_transformers==2.2.2
*pip install flask
Download the model and create a model folder and add it.
• python ingest.py # only once until the db folder is generated with all the training data
• python app.py # execute this command to run the application
Bot will generate random and specific topic quizes from trained datasets based on user requirement.
Bot generates different types of questions in quiz like multiple choice, true or false and open-ended.
Bot will provide feedback as score to user once user completes quiz.
Bot works both as quizbot and chatbot.
We trained our bot using lecture slides and network security textbook(Network Security Essentials: Applications and Standards sixth edition - by William Stallings)