Analyze text intents, sentiment, topics, and generate a summary within with this custom operation, powered by Deepgram.
Speaker 0: The Directus AI text intelligence operation allows you to analyze bodies of text and generate summaries, topics, intents, and sentiments powered by Deepgram. Today, I'm gonna show you how to set it up using a manual flow trigger. Inside of this episode's collection, we have items representing podcast episodes with a transcript of every word that is said inside of this podcast. What we're gonna do is set up a manual flow. So when we click a button here, it will generate a summary using the text intelligence operation.
And, of course, we're gonna do it manually, but you could do this automatically on the creation of a new podcast or a new transcript, but we're gonna do it manually. So let's head over to our flows and create a new flow called summarise. We're gonna do this based on a manual trigger on the operations collection. Now whenever this runs, all we get is the ID of the item where the button was pressed. We obviously need the summary.
We need the transcript rather. So the first thing we'll do is we will create a read data operation, and what we'll do is say in the episodes collection, we want to access trigger dot body dot keys 0. So this will return the whole object including the ID, the file ID, the transcript, and the currently empty summary field. So we're then gonna send this off to the AI text intelligence service here. And the first thing you'll need to pop in is a Deepgram API key.
The second thing you need to put in is actually the text itself. Unfortunately, this will have been returned in the last operation, and it's called transcript. So we can just send that off like so. So this will go off. It will it will return summaries, topics, intents, and sentiments.
And for topics intents and sentiments, it will kind of break that down for different portions of the text. And for sentiments, you'll also get a kind of average summary, which is really useful if you wanna say, you know, a call into your, you know, call center or a call with a prospect or something like that. What was the general sentiment from beginning to end? So as I said, this is gonna return quite a lot of data. We only care about the summary.
And what we wanna do is actually save that summary back to the item where we clicked the button. So that was in episodes, and the ID was trigger dot body dot keys 0. And the payload, what we actually wanna update that item with is a summary field. So we wanna update the summary field, and we want the value of that to be last dot summary dot text, like so. So if we hit save, this is actually the whole operation, the whole, sorry, flow.
So we click the button. We grab the whole item. We send it off to the text intelligence service, and then we save the outcome. Of course, you don't need to save it back to the item. You could simply send an email out or do something else with it, but we're gonna save it back to the item.
And if all has worked, I should be able to click this summarize button, wait a few seconds. It's being summarized. Topics are being generated. Intents and sentiments, we're grabbing just the summary, and there we go. There's the summary.
So I'm sure you can see all of the ways this can be applied. It's really flexible. It's really interesting. And, again, it's not just summaries. It's topics.
It's intents, and it's sentiments. So I hope you found this interesting, and I'll see you in the next show.