Get startedGet started for free

Content generation

AI is playing a much greater role in content generation, from creating marketing content such as blog post titles to creating outreach email templates for sales teams.

In this exercise, you'll harness AI to generate a catchy slogan for a new restaurant. Feel free to test out different prompts, such as varying the type of cuisine (Italian, Chinese, etc.) or the type of restaurant (fine-dining, fast-food, etc.), to see how the response changes.

This exercise is part of the course

Working with the OpenAI API

View Course

Exercise instructions

  • Create a request to create a slogan for a new restaurant; set the maximum number of tokens to 100.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

client = OpenAI(api_key="")

# Create a request to the Chat Completions endpoint
response = client.chat.completions.create(
  model="gpt-4o-mini",
  messages=[{"role": "user", "content": "____"}],
  ____
)

print(response.choices[0].message.content)
Edit and Run Code