How I migrated an old solution to a more elegant, robust and scalable solution using text classification from openAI
As mentioned in the previous article, I talked about how I learned the foundations of machine learning in order to solve a problem with text classification. Due to the lack of experience with machine learning and AI, it was pretty important to be pragmatic and find a solution that would be:
- Simple to use and maintain;
- Not expensive;
- Compatible with existing solutions;
- Quickly classify big amounts of text;
- Ability to be constantly improved and refined;
From the conducted research, OpenAI seemed at first glance the one that would fit the solution requirements.
With just a few lines, you can make a request to the openAI api to get a classification response. For the sake of the demonstration, I used an example from the examples reference.
import OpenAI from "openai";// Initialize the openai api key
const openai = new OpenAI({
apiKey: 'OPEN-AI-API-KEY'
});
const response =…