Uses OpenAI's ChatGPT API to generate multiple choice quiz with user defined language, topic, and difficulty.
Features a loading screen with random facts to give the user something to do while the data is retrieved from the API and an ending screen with score-determined gifs and sarcastic messages.
gpt-3-turbo
APIuseAudio()
hook)create-next-app
(development and building)A custom prompt is created by interpolating user entered form data. Crucially, the response is asked to be returned in JSON format. Light "prompt engineering" was required to ensure the response was consistently in the correct format (for example: explicitly saying what the names of the keys should be).
The API is queried. After playing with the available parameters, I found leaving most of them at their default setting worked well.