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.
Prompt inspired by this repo. Dockerfile for the frontend taken from this gist.
- 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?
- Docker
- Docker Compose
- OpenAI API key
- Clone the repo
- 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
- 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
- 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
- Access the frontend at
localhost:3000
cd backend
pipenv install
pipenv shell
python app.py
cd frontend
npm install
npm run dev