To AI or not to AI
We have been living with AI tools for a long time now and we’ve all heard the fuss about AI, how it would change the world, how it would make our lives better and I decided to explore things from a developer perspective or even from a user perspective.
As a user or even as a company we don’t develop in-house AI, it’s an extensive process involving multiple areas such as specialized expertise, machine learning, specific hardware, different challenges and eventually it doesn’t make sense at all because by the time we develop it, the cloud tech would have advanced way further.
So, we as users or developers have to rely on existing AI models which already exist, are trained with extensive dataset and can be used relatively easy by an end user via a browser or an existing API. I’ve come across multiple articles about AI and the more time I’ve spent reading I found myself thinking. All these articles are like politicians, they talk a lot but say nothing, they discuss topics and AI applications but don’t show any real examples.
Let’s do something real then and see how it goes.
Surely, the most famous model there is ChatGPT, everyone is using it, talking about it, it gets constantly upgraded via new models, it has an API endpoint that can be used by developers and so on.
CONTENT GENERATION
The model * (or in this case ChatGPT) uses so called prompts. A prompt is a text that the user provides which tells the model what is required. The communication between the user and the model is evaluated in terms of tokens. A token is a sequence of characters that are found within a text, both user prompt (what we ask the model) and the model’s response are measured in tokens.
Consider the following example. We’d like to explain to our customers that there has been a delay in the average response time in our helpdesk and we want to do so via email. For this, we’d like the model to generate us a polite email.
To do this, we create the following prompt:
“Write a polite email explaining customers about delay in helpdesk response”
Now, this prompt contains exactly 74 characters but in terms of tokens it’s evaluated to 12 tokens.
Write a polite email explaining customers about delay in helpdesk response
Tokens are important because they actually convert text into numerical representation which can be later digested by machine learning algorithms.
As promised I shall pinpoint the reality of things, and this is the first breakpoint. I quickly realized that tokens are actually AI’s currency. Yes, currency. Both prompt and model response are measured in tokens and to use the model, you have to pay for these tokens. Tokens cost differently for different models and at the time of writing this article (04/02/25), the pricing as as follows:
GPT-4o
High-intelligence model for complex tasks | 128k context length:
Price
Input:
$2.50 / 1M tokens
Cached input:
$1.25 / 1M tokens
Output:
$10.00 / 1M tokens
GPT-4o mini
Affordable small model for fast, everyday tasks | 128k context length:
Price
Input:
$0.150 / 1M tokens
Cached input:
$0.075 / 1M tokens
Output:
$0.600 / 1M tokens
The response that got for our prompt is as follows:
"Dear [Customer's Name],
We hope you are doing well. We wanted to take a moment to acknowledge your recent inquiry and sincerely appreciate your patience as we work through an unusually high volume of requests. Our team is committed to providing you with the best support possible, and we are doing our best to respond as quickly as we can.
Please rest assured that your request has been received, and we will get back to you as soon as possible. In the meantime, if your issue is urgent, you may find helpful resources in our [FAQ/Help Center link] or reach out to us at [alternative contact method, if available]. We truly appreciate your understanding and value your business.
Thank you for your patience, and we look forward to assisting you soon."
This response contains 752 characters and is evaluated as 152 tokens. Response highly depends on the prompt that we create so proper prompting is imperative in terms of AI models.
As you can see the email generated is very very good, it was generated in an instant and virtually saved me at least 10 minutes of my everyday life so CONTENT GENERATION is one of the things that AI models shine and are really good for.
LEARNING
Another proper usage of AI is for learning. If you’re researching particular topic or want to just get started with new stuff, AI is definitely the way to go. Most AI models are basically trained by summarizing huge amounts of data and datasets and they have access to knowledge at a speed that we can’t imagine. Consider you’re a student and want to learn PHP so we create the following prompt:
What is PHP?
If we are to Google this, we shall get a link to different pages which we have to first open, then digest while navigating through menus, advertisements and links.
The model response however is brilliant, pure short text containing the essence of what we asked. Moreover, the response looks like a human answer, it gives the most important information, suggests an example but doesn’t show it directly in order to not scare us with a code from the start. For a starter, it can’t get better.
Alright, we covered 2 really simple but real applications of AI in everyday life. Let’s get into something more technical and review some of the use cases of AI that are promoted everywhere.
Some of the use cases I’ve come across include:
CHATBOTS & VOICE ASSISTANT
There are multiple services out there, cloud based that offer a ready AI labeled chatbots that claim to answer up to 70% of customer queries. They act like widgets embedded in the page where customer is left with the impression that they talk with real person in real time. In reality, customers are talking with an AI chatbot which simulates human-like conversation. They do this very well until you start asking questions that relate to the product you see or particular issues that you have with service. Unless the chatbot is trained with exact dataset relative to the product you see or the company’s services and ways of doing business, the conversion quickly turns into infinite loop and no longer feels like human-like interaction. Visually everything seems fine but what a business owner expects is to have AI reduce their helpdesk load and communication load capacity. And here 70% is not enough, customers aren’t happy with 70%, they want 100% answers. The level of customer satisfaction depends on the amount of answers a chatbot has and this on other hand depends on individual chatbot training that a business owner must carry.
Training an AI model is essentially feeding it with vast amounts of business data. You have to provide a range of products, a range of services, a range of examples, not to mention a range of customer data.
And here we have the first 3 major issues:
- Businesses aren’t happy with sending customer data to third parties, and it’s not just about happiness, this involves data protection, regulations, GDPR and much more.
- Even if we are to send data for training purposes, the data itself will be large, this would consume huge amount of tokens and in effect it could end up quite costly for business. The cost depends on the amount of tokens used for training and fine-tuning.
- In reality about 40% of customers are asking basic questions that a generic chatbot can answer. For the remaining 60% the chatbot will not be useful and just waste of time. For business however, those 40% could mean reduced agent load and focus on actual support.
So, in that area AI is insufficient but still useful, I agree.
AUTOMATION
From a developer perspective the only thing that matters to me most is things that can make life easier, things that can be really automated and do not require my attention. Automation and optimization is imperative for any business. We’ve been developing extensions for Magento 2 for 15 years now and in these modern days of technology advancement, it is natural to seek ways to integrate AI into useful extensions for our customers. In most cases, a customer needs an extension that will make their life easier by reducing complexity, by automating some processes, by speeding things up or by applying a logic on multiple places in an ecommerce store.
We decided to explore how or if AI can be used to do some e-commerce automation. In a resend endeavour we had an idea to use AI to generate a list of related products in the wine industry. When you purchase a wine it is usually very specific in terms of region, sweetness, acidity, alcohol and others. To increase conversion rates, we wanted to display a list of related products with similar or close characteristics and have AI do this for us.
However we faced the following problems:
- We need AI to suggest products from a list of our own products, not from competitive sites
- We need to train AI with substantial information about our product by submitting all product data, including descriptions, attributes and more.
- We quickly realised that we have to provide the entire range of products and with more than 10k products, this could become a financial nightmare.
- It is also crucial to feed the model with every new product added.
Such type of automation still remains theoretical, in reality it cannot be achieved at all.
So, in this area AI has no real application whatsoever.
CODE GENERATION
In the earlier models, asking AI to generate code often produced basic code that needed a lot of refactoring to actually do something, but recent updates are really impressive in terms of output.
Let's ask the model to generate some PHP code for us using the following prompt:
Write a php script that can read RSS feeds in parallel
The generated code is actually quite decent. The code is clean and it's clear that the model is not just generating the code but it's designed with optimization and efficiency in mind. This is an area that current state of AI can perform very well and I expect things to improve in future.
However all AI models can and do 'hallucinate'. AI hallucination is a phenomenon wherein a large language model (LLM)—often a generative AI chatbot or computer vision tool—perceives patterns or objects that are nonexistent or imperceptible to human observers, creating outputs that are nonsensical or altogether inaccurate.
So in this case AI can be useful but human assesment and evaluation is still mandatory.
USE CASES
Lets review some uses case and if they can be used in reality in business or personal life
- Content generation
Definitely YES, AI is very very suitable for this purpose. It can generate useful feedback such as information, email templates, historical data, product descriptions, articles, books you name it.
- Learning
Definitely YES, AI has quick access to huge amount of data and can be suitable for learning
- Data analysis
Yes, as long as you're willing to submit sensitive information to third parties
- Personalization
Cloud based models have no practial application. In order to provide personalized information to customers, AI models have to access PI and sensitive data. This is possible only by running a local in-house AI model.
- Image recognition
Definitely YES, AI can be used to analyze images and extract structured data.
- Pricing optimization
Limited or no practical application. Pricing optimization depends on forecasting, access to large datasets, access to real time pricing from competators and more which is currently not available in the real world.
- Moderation
Definitely YES, AI can be used to moderate content and quickly detect harmful content.