This project develops a solution called Quiz Builder, which dynamically generates quizzes based on user-provided documents, ranging from textbooks to scholarly papers. The tool offers a tailored learning experience with instant feedback and comprehensive explanations, facilitating deeper comprehension and retention of knowledge.
This project involves developing a Quiz Builder using a range of technologies, including Google Cloud Platform, Google Gemini, Vertex AI API, Vertex embeddings, Chromadb, Langchain, PDF loader, and Streamlit. It is part of the challenges set by Radical AI, with contributions focused on specific implementation steps.
This Quiz Builder dynamically generates quizzes based on user-provided documents, ranging from textbooks to scholarly papers. The tool offers a tailored learning experience with instant feedback and comprehensive explanations, facilitating deeper comprehension and retention of knowledge.
__init__
method, initialize VertexAIEmbeddings, and test the setup by embedding "Hello World" in Streamlit.conda create --name quizzify python==3.10 -y
and activate it with conda activate quizzify
.pip install -r requirements.txt
in the project directory.* Create a new Google Cloud project.
* Enable the Vertex AI API for the project.
* Create a service account with necessary roles (e.g., Owner, AI Platform Admin, Vertex AI Administrator, Vertex AI Model Creator).
* Initialize Google Cloud in the terminal with `gcloud init`, follow the steps shown in the terminal, and run `gcloud auth application-default login` to log in to your Google Cloud account.
your_script.py
- main script) and view it in your browser at http://localhost:8501
.Document Processing Document processing involves creating a class that manages the ingestion of PDF documents. The process includes uploading PDFs via a Streamlit widget, chunking the documents into manageable pieces, and storing them for further use. The document processor handles temporary files, processes them into chunks, and returns a set of documents with associated metadata for later use in the system.
Embedding Client The embedding client converts extracted text from documents into embeddings using Vertex AI and LangChain. This lightweight class processes documents to generate vector representations, which are essential for integrating with ChromaDB and handling semantic data. The class facilitates efficient embedding of text and provides a foundation for subsequent data processing tasks.
Quiz Generation The Quiz Generator class creates multiple-choice questions by leveraging a large language model and a vector store. It initializes with a system prompt and uses the model to generate questions based on specified topics, integrating contextual information from documents. The class employs LangChain for managing prompt templates and contextual searches, ensuring that questions are relevant and well-structured.
Generate Quiz Algorithm The Generate Quiz Algorithm method constructs a quiz by generating a specified number of unique questions on a given topic. It uses a loop to create questions, verifies each one for uniqueness against an existing question bank, and handles potential duplicates by skipping them. The algorithm also incorporates a validation function to ensure the questions do not repeat, ensuring a diverse set of questions for the final quiz.
Screen State Handling Screen State Handling manages the flow between different screens and forms in the Quizify application. It utilizes Streamlit’s session state to keep track of the current question index and the status of the quiz, allowing users to navigate between questions without losing their progress. By storing and updating the question index and other relevant data in the session state, the application ensures a smooth and consistent user experience across different interactions and screens.
Output
We welcome contributions to enhance the features and functionality of Gemini Explorer. Please follow these steps to contribute:
This project is based on Mission-Quizify, developed by RadicalXDev. A big thank you to the entire team for providing the foundation for this project and the platform for honing our skills and expertise.
Radical AI: For providing the challenges and inspiration that drove this project.
Streamlit: For facilitating the development of the user interface.
Google Cloud Platform: For offering the APIs and services essential to this project.
Langchain: For providing the framework and advanced text embeddings technology.
Chroma: For providing the powerful vector storage and retrieval solutions.