Hands-On Activity: Analyze Sentiments Using Text Completions API

Learn how to use the Text Completions API in a real-world program.

In this section we will use the OpenAI API to analyze a given piece of text to determine if the sentiment is positive, negative, or neutral.

Creating a sentiment analyzer

Complete the following steps by adding the code to the editor below. Feel free to experiment by changing some things up.

Step 1: Add this variable to store the text that should be analyzed.

Get hands-on with 1200+ tech skills courses.