Classification

Learn how to perform classification tasks using the completions endpoint.

Overview

Classification is the process of categorizing the data into groups. In this lesson, we’ll focus on the text classification problem. There are many applications of text classification, including sentiment analysis, natural language inference (NLI), and grammatical verification. We’ll use the chat completions endpoint of OpenAI to classify the text data, which can be used to label any text without fine-tuning the model. To classify the text, we provide the task description and some optional examples with labels.

Press + to interact
Classification
Classification

We input the prompt text and request parameters into the OpenAI API’s model to classify text.

Press + to interact
Completions: classify text
Completions: classify text

Single tweet classifier

The input parameters are the same as we saw in the previous lesson. Let’s see how to provide a prompt to the API for classification:

Classify the Tweet's label as positive, neutral, or negative.

Tweet: I loved the
...