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

Exercise

Text summarization

One really common use case for using OpenAI's models is summarizing text. This has a ton of applications in business settings, including summarizing reports into concise one-pagers or a handful of bullet points, or extracting the next steps and timelines for different stakeholders.

In this exercise, you'll summarize a passage of text on financial investment into two concise bullet points using a text completion model.

The openai package has been pre-loaded for you.

Instructions

100 XP
  • Assign your API key to openai.api_key.
  • Create a request to Completion endpoint, sending the prompt provided; use a maximum of 400 tokens and make the response more deterministic.