How I build my first ever AI Project


Introduction
The first ever AI project that I ever made was a persona based AI project where I trained a GPT-model Gemini-2.0-flash
and it was successfully able to mimic the behavior of famous tech entrepreneur Hitesh Choudhary. It was not as much of a rocket science as I believed it to be. In this article I will explain how I created the chatbot without making frontend and how its only one prompt away from becoming your own custom persona.
Tech Stack Used
I wanted this project to be a simple beginner friendly tutorial. Therefore, I didn’t make frontend myself, rather I used Streamlit
a free frontend builder.
Gemini API
- Free APIs available, you can also useOpenAI’s
API as it is the industry standard, however no free options are available, a minimum recharge of 5$ is sufficient for this and many projectsPython >= 3.13
- I coded this in popular ML language pythonuv
package manager - I am not a fan of how we have to set up virtual environment and make a requirements.txt file every time we make a project, so instead I used a fast python package calleduv
by Astral docs. It creates a project environment and “it’s essentially like npm for python”Dependencies -
python-dotenv
,google-genai
,pillow
andstreamlit
Walkthrough
First I initialized the project using
uv init
. This will generate the pyproject.toml file and initialise a virtual environment for you.Then in main.py, I imported all necessary modules and made the GPT client. Then I learned how to use
streamlit
through their docs and made an average UII made sure to store my api key in a .env file as it is a safe measure and standard
Then, the most important part of the project, the SYSTEM_PROMPT. This is the part which is known as prompt engineering generally. This is where yu set the rules and explicitly mention how the AI should behave. I inserted data of my desired persona here for it to mimic that person
Problems I faced and how I solved them
During this project I faced many errors but with each error comes a new opportunity to learn
Chat history was one of the things I struggled with, however with the help of docs I learned about
streamlits
session handling capabilities. With my newfound knowledge I was able to implement a fully functioning chat history after some tweaksI made some basic errors in my project and solving them clarified my python project boilerplate understanding
One of my biggest mistake was installing
dotenv
when the correct dependency waspython-dotenv
Also after deployment my app did not run, after some troubleshooting I realised that streamlit cannot access the
.env
file so it could not detect the API Key. So it needs to be given in a special file that can be accessed in streamlit cloud
Takeaways
You do not need mathematics for making chatbots for development purposes. They are needed by data scientists
By altering the SYSTEM_PROMPT anyone can create any persona
Not knowing how to make UI is not a barrier towards positive ML development
We can only make a project through problem solving and debugging
Anyone can create chatbots with just a little bit knowledge about GPT. To learn more see my article on GPT for dummies
Related Links
Subscribe to my newsletter
Read articles from Kaustuv Chatterjee directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Kaustuv Chatterjee
Kaustuv Chatterjee
I am a code enthusiast and a full-stack developer. My goal at hashnode is to write and immerse myself in the writing of technical content. My wish is to learn and help others learn at the same time. Hoping to make a difference in the tech world.