Publish LLM-Generated Audio Alerts to Slack with Graphlit, GPT-4 and ElevenLabs
Kirk Marple
February 3, 2024
As we showed in the previous GPT-to-Audio tutorial, integrating LLMs such as OpenAI GPT-4 with text-to-speech models from ElevenLabs can generate compelling content for a variety of use cases.
One compelling use case for end-user productivity is the generation of semantic alerts, based on recent emails, Slack messages or documents.
In this example, we've created a periodic alert, which summarizes recent Google Mail emails, writes an audio-ready script with GPT-4, publishes an MP3 using an ElevenLabs voice, and then posts to a Slack channel.
This is a great way to catch up on recent emails, after a meeting, or first thing in the morning. The user can click "Listen to your audio summary" and listen to the generated audio summary.
Semantic Alerts are not limited just to emails, and can be used to summarize any recently ingested content, such as Slack messages, documents uploaded into a SharePoint library, or even images taken on an iPhone (and described using the OpenAI GPT-4 Vision model).
Since alerts build on the semantic search capabilities in Graphlit, we can also filter by observed Persons, Organizations, Labels, etc., so we can focus on relevant topics. Multiple alerts can be created, with different publishing prompts, so we can create targeted alerts just for financial invoices and payments due vs. any messages related to a specific person or company.
🔉 Listen to an example here.
Create Google Mail Feed
Before creating our Slack alert, we need to create a feed to read all the future emails in our Google Mail account.
By assigning the type
to NEW
, we will reading new emails, every 3min, according to the schedulePolicy
assigned.
This requires an OAuth refresh token to the desired Google Mail account.
Mutation:
Variables:
Response:
Create Slack Alert
When creating our Slack alert, we will need a bot token to authenticate to the user's Slack channel. More information on creating a Slack application with appropriate scopes can be found here. In the integration
section, we will assign this bot token
and the Slack channel
. We don't need to specify the Slack workspace, since that will already be known via the bot token.
We want to create an audio alert, which posts an MP3 to the Slack channel, using an ElevenLabs voice. We will need to assign the type
to ELEVEN_LABS_AUDIO
, and specify the ElevenLabs model
and voice
. It's possible to use one of the predefined ElevenLabs voices or create your own custom voice.
Alerts take a schedulePolicy
similar to feeds, and are telling the alert to check for new emails every 5min, since we also are specifying a content filter
for EMAIL
content type. The content filter supports a wide range of filters, including filtering by feed, filtering by date range, or filtering by similar content by text embeddings. (This is the same content filter that can be used when querying contents and creating conversations.)
When the alert executes, it will query recent emails, and summarize each of them with a default LLM summarization prompt and the Azure OpenAI GPT-3.5 Turbo 16k model. Then it takes the publishPrompt
we provided, and writes a text script to hand to the ElevenLabs model to convert text-to-speech as an MP3 file.
Example Publish Prompt:
The Slack integration automatically posts the text script and a link to the generated MP3 file to the desired Slack channel.
Alternately, we could have used a Slack text alert, which posts Markdown formatted text to the Slack channel.
Mutation:
Variables:
Response:
By combining the power of LLMs, such as OpenAI GPT-4 Turbo, with the latest text-to-speech models from ElevenLabs, Graphlit helps you create semantic alerts, based on user content such as emails, Slack messages or documents.
Summary
Please email any questions on this tutorial or the Graphlit Platform to questions@graphlit.com.
For more information, you can read our Graphlit Documentation, visit our marketing site, or join our Discord community.