Building AI Tools
Building AI Tools
Before diving in, make sure you have the necessary tools installed on your
machine. Follow these links to install VSCode and Python3:
https://code.visualstudio.com/
https://www.python.org/downloads/
I will give you a simple script. You just need to copy and tweak a little bit, and
then you can build almost any AI tool you want!
After you finish the post, you will be building your first AI tool in less than 2
minutes without writing any code.
You will just use my script, prompt, and some commands That I will share with
you here.
So, like any tool, an AI tool consists mainly of the UI (User interface) and the
backend process, which basically generates “Something with AI.“
To make things simple, let’s go with a practical, real example. Let’s Build an
“AI Blog Title Generator Tool“
User Input: The starting point of any AI tool is the user input. For instance, in
our example, the blog title generator tool, a user inputs a topic, e.g., digital
marketing.
Then, this prompt will be sent to the OpenAI API or any other AI API, which
will then generate relevant titles.
Finally, the generated response will go back to the user and be displayed in
the UI.
Ok, the idea seems simple and straightforward, but there is one Main
challenge that faces us when we build AI tools. It is achieving consistent,
structured responses from AI models.
Causes of Inconsistency
1. Varied Prompts and Responses: Different prompts can lead AI
models to generate responses in various formats. For example, asking
for ‘five blog titles’ might return a list in one instance and a paragraph in
another.
2. Model Behavior: AI models, especially those based on machine
learning, can exhibit non-deterministic behavior. The same prompt
might yield slightly different responses upon repeated requests.
3. Complexity of Natural Language: Natural language is inherently
complex and nuanced. AI models sometimes interpret the same prompt
in different ways, leading to varied responses.
In one instance, a request for blog titles about ‘digital marketing’ might return a
straightforward list. In another, the model might provide a more descriptive
response, including explanations or additional information.
Try it yourself on ChatGPT, ask it to generate 5 blog titles multiple times, and
look at the response!
But today, I want to make things way easier. I prepared a script for you; this
script will handle this problem and help you get consistent results every time
without worrying about the underlying code.
https://github.com/MeryemN/Building-AI-Tools
Open the Python script (app.py) in VSCode or any IDE you want. Just replace
the fields and test!
Terminal :
You will see you will get consistent JSON every time you run the program.
Problem Solved
Ok, let me share with you method to create a UI for your AI Tools.
What is Streamlit?
To make things simple for you and create the UI with Streamlit in seconds, I
prepared a special Power Prompt that can transform almost any Python script
into a Streamlit app!
ChatGPT will create the full Streamlit code with you and explain every step.
I designed it to help beginners get started easily and understand what is going
on.
So, in our project, create a new script, let’s name it “ui.py” and paste the
generated code.
Terminal :
Wait for seconds, and you will see your AI app up and running in your
browser.