How I migrated an old solution to a more elegant, robust and scalable solution using text classification from openAI
As mentioned within the previous article, I talked about how I learned the foundations of machine learning to be able to solve an issue with text classification. As a result of the dearth of experience with machine learning and AI, it was pretty essential to be pragmatic and find an answer that will be:
- Easy to make use of and maintain;
- Not expensive;
- Compatible with existing solutions;
- Quickly classify big amounts of text;
- Ability to be continually improved and refined;
From the conducted research, OpenAI seemed at first glance the one that will fit the answer requirements.
With just a couple of lines, you possibly 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 = recent OpenAI({
apiKey: 'OPEN-AI-API-KEY'
});
const response =…