Machine Learning + openAI: solving a text classification problem | by Ricardo Ribas

Published:


How I migrated an old solution to a more elegant, robust and scalable solution using text classification from openAI

Towards Data Science
Photo by Hunter Harritt on Unsplash

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:

  1. Simple to use and maintain;
  2. Not expensive;
  3. Compatible with existing solutions;
  4. Quickly classify big amounts of text;
  5. 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 =…

Related Updates

Recent Updates