GPTrivia is an AI-based trivia game where contestants answer questions generated by Chat GPT. This game explores possible applications for implementing generative AI in web development. While GPTrivia utilizes a relatively simple aspect of OpenAI API, this project presents how generative AI can make online interfaces interactive in a sophisticated way.
Play the game here
It has been almost 30 years since a computer beat the chess world champion. It's been over a decade since humans lost a Jeopardy game to a machine. And last year, machine-generated art won an art contest. As machine learning technology improves exponentially, it is time to admit our loss and turn the tables. Long gone are the days when machines try to prove their intelligence and knowledge to humans. Now, humans can demonstrate their knowledge to machines.
Running the application on a remote server
I created a Node.js web application and ran it on a Digital Ocean remote server. Then, I used Express and Socket.io to communicate between the server and the clients. I used the server to define the order of the clients on the screen, send them the questions from the OpenAI API, and keep the score of the players. On the client side, I checked whether the player pressed the correct response and sent it back to the server.
Natural language - programing language writing
"generate a four-choice trivia question as a string formatted like this: the question '/' each answer '/' correct response"
While this prompt is not written in any programing language, it was the main component of the program and allowed me to use GPT's response as data. Using it allowed me to have an array of possible responses and populate the response
Find the code here
Special thanks to: