In this technical article, we will explore how to leverage the ChatGPT 4 API along with Google Meet, Google Drive, and Google Docs APIs to automatically generate meeting minutes.
Taking minutes during a meeting can be a time-consuming task, and it is often difficult to capture everything that is discussed. With the use of artificial intelligence, the process can be streamlined to ensure that nothing is missed.
As Microsoft Teams or Zoom, Google Meet has the ability to record meetings. Once the recording is activated, the transcript of the meeting is generated in a Google Document format and is stored on a defined Google Drive shared folder. Google Meet transcript file is used here but similar transcript text extract could also be done with Teams or Zoom recording.
For this, a simple web application will be used as a central point to manage the user interaction as well as the different API calls. The purpose is to display a list of these meeting transcript documents stored on a predefined Google Drive folder. The user will be able to select one of them then press a button to generate a summary of the meeting minutes as well as the action items with due dates. Also, these two new sections will be inserted in the same Google Document with Google Docs API, containing the results from ChatGPT API.
This article will walk you through the steps required to set up the necessary configuration and to understand the Dash/Python application code used to manage the ChatGPT, Google Drive & Docs APIs.
A link to my GitLab containing the full Python/Dash source code is also available on the next sections.
By the end of this article, I’ll also share my thoughts on some limitations and improvements that could be done on this application. I hope it will allow you to find new ideas on how to stay focused on more valuable tasks than taking meeting minutes.
So let’s dive in!
The web application looks like the screen below. The upper section displays a list of transcript documents present on the user’s shared Google Drive folder. Such documents are automatically generated in the ‘Meet Recordings’ folder when the user triggers the Google Meet recording button.
The user can select a document in the list. The selected document is displayed in the central part. Finally, the user can press the button to generate the meeting minutes.
Once the button pressed, the Meeting minutes are automatically inserted in 2 new sections:
The ‘Meeting Summary’ section is a short description of the meeting based on the meeting transcript. It will stay synthetic whatever the duration of the meeting.
The ‘Meeting Action Items’ section is a numbered action items checkbox list which is also based on the transcript. When known, a due date is also inserted.
Each numbered meeting action item contains a checkbox that is natively supported by Google Docs. They could be used later on by your teams to follow up the action list and to check them once they are done.
The following will allow you to edit and run the code present on my GitLab. Before doing that, you’ll need to register at OpenAI to get your API key. Also, Google Drive and Docs APIs need to be activated on the Google console, as well as creating a Google Service Account.
- Go to the OpenAI website and sign up to get your API Key
- Go to my GitLab project named Meeting Minutes generation with ChatGPT
- Edit the Jupyter Python notebook with Google Colab and save it on your own Colab folder
- Replace the ‘OPENAI_API_KEY’ value in the code with your own api key
- Use the following link to activate the Google Drive & the Google Doc APIs
- Use the following link to create a Google Service Account
- Download and save the Google Service Account Key (JSon File) in your Colab folder. Name it ‘credentials_serviceaccount.json’ (or change the value in the code)
- Share your ‘Meet Recordings’ Google Drive folder with the Google Service Account created previously (with ‘Editor’ permission)
- Attend a Google Meet meeting. Record it with the transcript. The video file and the transcript document will automatically be generated in your ‘Meet Recordings’ Google Drive folder
- In the code, replace the ‘GOOGLE_MEET_RECORDING_FOLDER’ value with the ID of your ‘Meet Recordings’ Google Drive folder shared previously
- Select ‘Run All’ in the ‘Execution’ menu
- A WebApp should start in a few seconds. Click on the URL generated in the bottom of the Colab notebook to display it
The application should look like the first screenshot in the previous section.
As of today, the ChatGPT 4 API is still in beta. The used version in the code is ‘gpt-4–0314’ snapshot. It can also be switched to the current version, ‘gpt-3.5-turbo’.
I’ll focus only on the most important pieces of the code.
4.1. Google Drive integration / API
The first two lines of code are used to mount your Google Drive root folder. The main usage is to retrieve the Google Service Account credential key (JSon file) generated within the Quick Start section.
The code of the next section retrieves a file list of all transcript documents stored in the Google Meet Recording folder. The list will be used later to display these documents on the web application.
4.2. Google Meet transcript document text extract
These functions are used to extract text elements from a defined Google Document ID. Google Meet generates a paragraph named ‘Transcript’. The location of the ‘Transcript’ section is identified and will be used later as a starting point to insert the meeting minutes. The two sections inserted by the application will be located just before this ‘Transcript’ section. (and right after the ‘Attendees’ section)
4.3. ChatGPT preparation: break down of the transcript text into chunks
ChatGPT API models have a limited number of tokens per request. In order to stay compatible with the ‘gpt-3.5-turbo’ model, the max value used in the code is 4096 tokens per request. But keep in mind that the ‘gpt-4’ model can handle much more. A 8k or a 32k models are also available, they can be used to significantly improve the meeting minutes’ quality for long meetings.
As a consequence, the Google Meet Transcript document text needs to be broken down into chunks of 4000 tokens with an overlap of 100 tokens.
These functions will prepare and return a list of chunks that will be used later by the ChatGPT API.
4.4. ChatGPT API usage
This function generates the meeting summary and action items in a few steps. A ChatGPT API call is done for each of them:
- Step 1: Summarize the meeting transcript text. The function iterates over the chunk list generated previously. The content sent to ChatGPT is based on the recorded conversation between the attendees. The ChatGPT API is called for each chunk with the following request: ‘Summarize this meeting transcript: <chunk>’
- Step 2: Consolidate the response (Meeting summary) from Step 1. The ChatGPT API is called with the following request: ‘Consolidate these meeting summaries: <ChatGPT responses from Step 1>’
- Step 3: Get action items with due dates from the transcript. The function iterates over the chunk list generated previously. The ChatGPT API is called for each chunk with the following request: ‘Provide a list of action items with a due date from the provided meeting transcript text: <chunk>’
- Step 4: Consolidate the meeting action items from Step 3 in a concise numbered list. The ChatGPT API is called with the following request: ‘Consolidate these meeting action items with a concise numbered list: <ChatGPT responses from Step 3>’
Each ChatGPT API used parameter (i.e. ‘temperature’) is documented in the code.
4.5. Google Docs API management usage to insert the final meeting minutes
The objective of this function is to insert the meeting minutes into the Google Doc selected by the user. The text is inserted before the ‘Transcript’ paragraph. The start index identified in the previous functions is used here as a starting point.
Two sections are inserted here: ‘Meeting Summary’ and ‘Meeting Action items’.
Each section’s insertion is done with the following steps:
- the section’s title is inserted (as a text i.e. ‘Meeting Summary’)
- its style is set to ‘HEADING_1’, its text style is set to ‘bold’, its font size is set to ‘14’
- the section’s content is inserted (this comes from the ChatGPT API result)
- its style is set to ‘NORMAL’. A bullet point is also inserted with an arrow for the ‘Meeting Summary’ section and a checkbox for the ‘Meeting Action items’ section
Some ‘tabulation’ and ‘new line’ characters are also inserted to correct the text returned from the ChatGPT API.
Tip: Please note that the ‘ar’ table is iterated in a reversed way to ensure the start index position stays always up to date following each text insertion.
4.6. The main Python Dash Web Application
This part is used to build a simple web application on which the user can interact. Basically, it displays a list of documents stored on a Google Drive shared folder. The user can select one of them which is displayed in the central part of the screen. Once the button is pressed, the meeting minutes are inserted into this document. The updated document is refreshed with the results.
This code is built on top of the Dash framework. It even works within a Google Colab notebook.
Each document is displayed within a dedicated iFrame. The document’s link is based on ‘embedLink’ value, previously retrieved by the Google Drive API.
Also, a progress bar is displayed during the ChatGPT API calls and the Google Doc meeting minutes’ insertion steps.
The main challenge using ChatGPT within your company is to have a leak of sensitive information your company is working on. This happened recently at Samsung where employees have accidentally leaked company secrets with ChatGPT.
One of the improvements of this code could be the execution of data masking before calling the ChatGPT API. At least the attendee names and additional tagged fields containing sensitive information should be masked. The meeting name could also contain some tags for data masking. I.e ‘Meeting with <Microsoft>’ where ‘Microsoft’ will be masked on the entire transcript document data extract. Once the response is received from ChatGPT API, the reverse needs to be done. Each masked information needs to be unmasked before calling the Google Docs API.
For this, a reference table needs to be used to store each field ID with its clear and its masked value. So these fields could be masked before calling the ChatGPT API, then unmasked when inserting the meeting minutes’ sections with Google Docs API.
Thank you for reading my article to the end, hope you enjoyed it!
As you can see, ChatGPT 4 API combined with Google Drive/Docs APIs are very powerful and can contribute significantly to improving your day-to-day work.
You can find the entire source code on my GitLab: Meeting Minutes generation with ChatGPT