
#  Content generation

```
Exercise ID 1578130
```

##  Assignment 

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 through the `Completion` endpoint to generate a catchy slogan for a new restaurant. Feel free to test out different prompts, such as varying the type of cuisine (e.g., Italian, Chinese) or the type of restaurant (e.g., fine-dining, fast-food), to see how the response changes.

The `openai` package has been pre-loaded for you.

##  Pre exercise code 

```
import openai
```



##  Instructions 

- Assign your API key to `openai.api_key`.
- Create a request to the `Completion` endpoint to create a slogan for a new restaurant; set the maximum number of tokens to `100`.



```
# Set your API key
openai.api_key = "____"

# Create a request to the Completion endpoint
response = openai.____.____(
  model="gpt-3.5-turbo-instruct",
  ____
)

print(response["choices"][0]["text"])
```

##  Hints 

- The `prompt` to the model should be an instruction to create a new restaurant slogan.
- Set the maximum number of tokens using the `max_tokens` argument of the `Completion.create()` method.



##  Solution 

```
# Set your API key
openai.api_key = "<OPENAI_API_TOKEN>"

# Create a request to the Completion endpoint
response = openai.Completion.create(
  model="gpt-3.5-turbo-instruct",
  prompt="Create a slogan for a new restaurant.",
  max_tokens=100
)

print(response["choices"][0]["text"])
```


