Skip to content

Latest commit

 

History

History
69 lines (58 loc) · 2.29 KB

README.md

File metadata and controls

69 lines (58 loc) · 2.29 KB

AiQuizzer

Another ai playground project. Use the OpenAI API to generate multiple choice questions with context from PDF files - stored in chromadb - to test your uni knowledge.

Screenshot of AiQuizzer

Prompt inspired by this repo. Dockerfile for the frontend taken from this gist.

To do

  • Refactor backend (Move chromdb and openai logic to separate files)
  • Add logging with loguru
  • Function to automatically process new PDFs in chromadb while docker is running
  • Gamification (e.g. points for correct answers, emoji awards for streaks)
  • Error handling (e.g. if no questions are generated)
  • Exclude headers and footers from PDFs (tricky)
  • Add Qualitiy checks in question generation (Multiple API calls? Or use GPT 4?)
  • Refactor frontend (Undestand svelte, clean repo, make UI less ugly)
  • Add more question types (e.g. True/False, Fill in the blank)
  • Make docker use Pipfile for backend?

Local Deployment

Pre-requisites

Setup

  1. Clone the repo
  2. Create a .env file in the ./backend directory with the following variables:
OPENAI_API_KEY=<your key>
TEXT_FILTER=<your filter>  # e.g. "University of Hanover; Pof. John Smith". These strings will be removed from the PDFs before they are sent to chromadb
  1. Create a docs directory in the ./backend of the repo and add your PDF files to it. Example structure:
backend
├── docs
│   ├── folder1 # Name of the folders will be used as collection name in chromadb
│   │   ├── file1.pdf
│   │   ├── file2.pdf
│   │   └── file3.pdf
│   └── folder2
│       ├── file1.pdf
│       ├── file2.pdf
  1. Run the following command in the root directory of the repo and wait for the containers to start:
docker compose up -d -f docker-compose.yml
  1. Access the frontend at localhost:3000

Development

Backend

cd backend
pipenv install
pipenv shell
python app.py

Frontend

cd frontend
npm install
npm run dev