
#  Creating meeting summaries

```
Exercise ID 1590076
```

##  Assignment 

Time for business! One time-consuming task that many find themselves doing day-to-day is taking meeting notes to summarize attendees, discussion points, next steps, etc.

In this exercise, you'll use AI to augment this task to not only save a substantial amount of time, but also to empower attendees to focus on the discussion rather than administrative tasks. You've been provided with a recording from [DataCamp's Q2 Roadmap](https://www.datacamp.com/resources/webinars/datacamp-q2-2023-roadmap) webinar, which summarizes what DataCamp will be releasing during that quarter. You'll chain the Whisper model with a text or chat model to discover which courses will be launched in Q2.

##  Pre exercise code 

```
import shutil
import openai

# Copy file so learners don't need to add directory path
shutil.copy("/usr/local/share/datasets/datacamp-q2-roadmap-short.mp3", "datacamp-q2-roadmap.mp3")
```



##  Instructions 

- Assign your API key to `openai.api_key`.
- Open the [`datacamp-q2-roadmap.mp3`](https://assets.datacamp.com/production/repositories/6309/datasets/9f56370cdaaa3e8090d5e30a7438f5ab3cdedd10/datacamp-q2-roadmap-short.mp3) file and assign to `audio_file`.
- Create a transcript from `audio_file` and assign to `transcript`.
- Prompt a text model using the text from `transcript` and summarize it into concise bullet points.



```
# Set your API key
openai.api_key = "____"

# Open the datacamp-q2-roadmap.mp3 file
audio_file = ____

# Create a transcription request using audio_file
audio_response = ____

# Create a request to the API to summarize the transcript into bullet points
chat_response = ____
print(____)
```

##  Hints 

- Open the `datacamp-q2-roadmap.mp3` file using the `open()` function, passing the second argument as `"rb"` to read binary.
- Chain a call to the Whisper model to transcribe the audio into a text model from either the `Completion` (e.g., `gpt-3.5-turbo-instruct`) or `ChatCompletion` endpoints (e.g., `gpt-3.5-turbo`).



##  Solution 

```
# Set your API key
openai.api_key = "<OPENAI_API_TOKEN>"

# Open the datacamp-q2-roadmap.mp3 file
audio_file = open("datacamp-q2-roadmap.mp3", "rb")

# Create a transcription request using audio_file
audio_response = openai.Audio.transcribe("whisper-1", audio_file)

# Create a request to the API to summarize the transcript into bullet points
chat_response = openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "List the courses that DataCamp will be making as bullet points." + audio_response["text"]}
  ],
  max_tokens=100
)
print(chat_response["choices"][0]["message"]["content"])
```


