Machine Learning
Machine Learning + openAI: solving the text classification problem | by Ricardo Ribas
How I migrated an old solution to a better, more robust and scalable solution using text segmentation from openAI
As mentioned in the previous article, I talked about how I learned the basics of machine learning to solve the problem of text classification. Due to the lack of experience in machine learning and AI, it was very important to be pragmatic and find a solution that would:
- Easy to use and maintain;
- It's not expensive;
- Compatible with existing solutions;
- Quickly edit large amounts of text;
- Ability to constantly improve and refine;
From the research carried out, OpenAI appeared initially to be the best fit for the solution needs.
With just a few lines, you can make a request to the openAI api to get a classification response. For the sake of demonstration, I used an example from the examples directory.
import OpenAI from "openai";// Initialize the openai api key
const openai = new OpenAI({
apiKey: 'OPEN-AI-API-KEY'
});
const response =…