Inspiration

I wanted to create a tool that would help students get better at debating topics more fluently without any stress. However, clubs and private tutors are not a great solution for a problem that just takes practice. For that reason, it would be best if an AI debated back with you, as it's cost-effective and gives you all the practice you need.

What it does

Debate AI is an AI that acts as a human debating against an educational topic of your choice. It takes ethics into account and automatically rejects debating against anything inappropriate or biased. You can argue anything educational with it and it will try to find flaws and points to argue against. The AI is great for when you need extra practice to talk comfortably and tests your brain to find points or weaknesses in an argument to snap back at the AI.

How I built it

I built it using the coding language Python. I used a framework called Flask to integrate the server with the website. The backend, running the Python server, transcribes the user's speech and handles all the requests to ChatGPT and returns the text and audio to the website. The website then plays and displays the text alongside it to show the user. Context history is also managed by the server so the website knows the previous messages the user and the AI chatbot had.

Challenges I ran into

I ran into multiple challenges that were really difficult for me. One was the actual audio recording of the user's speech, as I have never done a project involving recording voice messages. I had to look up tutorials and learn how to code that in JavaScript. Another challenge I faced was ChatGPT and context history, which was the hardest implementation. I didn't understand JSON with Python and kept messing up how to read and write to a JSON file to store the context history. When I figured it out, the base64 decoding for the ChatGPT audio was wrong and was broken, but I didn't realize it and thought it was still the context history that wasn't working. I finally managed to overcome this with a lot of print() statements and console.log() debugs to understand what I did wrong.

Accomplishments that I'm proud of

Definitely the context history/message logging, as it was by far the hardest thing to implement. I also had to rework the way I called ChatGPT's API, as the other way I used didn't use context and was meant for one-time chats. The second biggest accomplishment would be the audio recording for the user, as that took a lot of time to understand and learn. But when it worked in the end, it was a huge relief.

What I learned

I learned a lot about how to record audio input from the user, pass audio inputs from the frontend to the backend, and organize and store messages for context retrieval.

What's next for Debate AI

Making a new UI would be the next step for Debate AI, as the website is really bare; although it does give a simple, minimalistic view, some users might not really understand how to use it at first glance. Another step would be to introduce real-time AI, which is a really new feature introduced by OpenAI which the user and the AI chatbot can speak with reduced wait times to get as close as possible to recreating a real debate. Lastly, although this is not a required change, some users might prefer it: to introduce a feature where you can delete certain messages from your history. This can help if a person messes up and doesn't want to reset their whole conversation history.

Built With

Share this project:

Updates