Classification

Learn how to perform classification tasks using the completions endpoint.

Classification

Classification is the process of categorizing the data into groups. In this course, 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 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.

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 Text's label as positive, neutral, or negative.

Text: I loved the new Spiderman movie!
Sentiment:

Examples

Let’s try the above prompt in the code widget below:

Get hands-on with 1200+ tech skills courses.