Build An Audio AI App Transcripts
Chapter: Feature 3: Summarize
Lecture: AI Summary Steps in Review

Login or purchase this course to watch this video and the rest of the course contents.
0:00 There were a lot of moving parts in this whole example. So let's just simplify it back down to the essence. Remember we talked about prompt engineering
0:10 and how you can get dramatically different results if you set the stage, provide a little extra,
0:17 just a little extra info like what is this podcast about? And you kind of sweet talk the LLM. You're an expert, you're an expert journalist.
0:25 I wanna talk to you. Oh, I'm an expert, excellent. Let's answer it like that. All right, you're an expert journalist.
0:31 I need you to read the transcript and summarize it. So orange here is the action that we're asking it to do and the style that we're asking it to use.
0:41 And then we say this transcript comes from this podcast with a title 'cause we already know that for sure
0:46 out of the database, that could probably help. We can give it the subtitle text, which was, and the podcast covers things like,
0:53 and we give it the subtitle there. Sometimes it doesn't exist. So we got to kind of put that in a variable.
1:00 And then the title of the episode is whatever it is. And then we give it how the response should be. Your response should be a TL DR summary
1:08 of around five to eight sentences long. The way that I was seeing the results of always five sentences, maybe you just wanna pick how many sentences
1:16 you want it to be and just say that. Somewhere in the middle is a six sentences, I don't know.
1:23 All right, we do this and then we need to somehow send that and the other data off to Assembly AI. So we say lemur.task,
1:31 give it this context, which we just saw. And we say the model to use is basic, the max output size is 2000, the variability,
1:40 the creativity is 25% creativity, I suppose there. And then we give it the text, which is the full transcript text. Remember we had to generate that,
1:50 recompute that basically out of the database as an expression, super easy though. And then we just get the response back.
1:57 Final thing is remember task is synchronous and blocking. Look for task async if that shows up, and prefer to use that and then use the run future
2:06 that we wrote together. All right, here it is. Now we've got our summary text and off you go.
2:12 Do be aware for that LLM restatement text to appear in there and we saw that we can use regular expressions
2:18 as tricky as they can be to really nicely go and find that and remove that chunk from the summary.


Talk Python's Mastodon Michael Kennedy's Mastodon