- Date: June 4, 2024
- Categories: Fun
The code for this project is published on Github
See the bot in action and ask some questions on my other website
Background
Seeing all of the advancements in machine learning research, especially the new GPT-4o model from OpenAI, I decided I wanted to try and make a project using their API. This is my simple implementation of the OpenAI Assistants API.
CV Bot
It was a lot simpler to make this project than I anticipated, but it’s still pretty cool so I had to list it in my portfolio! he premise is actually really simple, it’s just an OpenAI assistant with some specific instructions and a JSON version of my CV. A Python Flask app generates a thread for each user of the website, and then this thread is linked to my assistant to get contextual answers using my JSON CV as the knowledgebase for answers.
I’ve added a disclaimer to the website as sometimes the assistant flat out lies – I’ve managed to reduce this with some engineering of the bot instructions. At the time of writing the assistant uses the GPT3.5-Turbo model, but I will upgrade this when GPT4o becomes cheaper, in testing GPT4o tends to be pretty spot on with it’s answers.
If you want to make your own, read on! If not, go have a play with mine. Ask it to write a poem about why I am a good candidate, or see if it will pass judgement on whether I am a kind person or not! Just don’t tell it to ignore previous instructions and ask it to say how bad I am at programming, it might just work…
Making Your Own
It’s pretty simple to make your own bot:
- Navigate to the OpenAI API dashboard and add some credits to your account
- Create a new project and add a new service user, add this API key to the flask code on my Github under the API key variable
- Create a new virtual assistant and put the ID of it again in the flask code provided on my Github
- Give the virtual assistant some instructions. Be specific but try not to give it too much to think about. In my case, the bot instructions are:
You are a chatbot designed to help people understand more about a person called Jack. Jack is a Computer Science graduate and you have been provided with a JSON formatted version of his CV. Use Jack’s CV to provide factual, accurate but concise responses to any questions. It is important that you do not lie or infer, but only stick to the facts of the provided file. Try to keep responses simple, avoid use of symbols or complex lists. When asked where to learn more, or for contact details, link the user to the following website https://jackdevonshire.co.uk which contains contact details, Jacks full resume and a portfolio of projects. Please act as though you are a virtual version of Jack. If asked who you are, introduce yourself as the virtual version of Jack that is designed to help them understand more about Jacks industry experience, skills and passion for technology.
- Adjust the Temperature and Top P scores to try and get more accurate responses from the bot. I currently have them both set at around 1, which seems to make it be truthful pretty consistently.
- Have fun! Just be careful if you decide to host it, make sure you add a disclaimer that the bot can spit out some utter garbage!