1. Learn
  2. /
  3. Courses
  4. /
  5. Working with the OpenAI API

Exercise

Code explanation

One of the most popular use cases for using OpenAI models is for explaining complex content, such as technical jargon and code. This is a task that data practitioners, software engineers, and many others must tackle in their day-to-day as they review and utilize code written by others.

In this exercise, you'll use the OpenAI API to explain a block of Python code to understand what it is doing.

The openai package has been pre-loaded for you.

Instructions

100 XP
  • Assign your API key to openai.api_key.
  • Create a request to the ChatCompletion endpoint to send instruction to the gpt-3.5-turbo model.