Build An Audio AI App Transcripts
Chapter: Feature 4: Chat Q and A
Lecture: Using the ask_lemur method for Real Questions

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I think we're ready to actually call this function in the UI. Now, before we do, I think actually this has,
0:07 I'm a little worried this is gonna limit some stuff. So let's take this out and we'll add it back if it becomes a problem.
0:13 Okay, so let's go over to our podcast views where we have, I have a question, I have asked it. Let's actually ask the question.
0:22 So we'll say this, we'll say chat equals await AI service, ask chat, and we put podcast episode email question. Now you might be thinking,
0:36 what if there's nobody logged in that could crash 'cause that would be none. Well, it's not getting past there, right?
0:41 That's our test we've already done. So this should be totally solid even with verifications and let's go ahead and put, there's two ways,
0:48 there's a more refined way we're gonna do this, but let's say chat.answer goes here. That should honestly be all we need to do to make this work.
0:57 Let's run it. And let's try it from the beginning on one of these. Let's go over here to reply all. We haven't done anything with them yet.
1:06 Reply all the world's most expensive free watch. No idea what this is about, but let's give it a try. You can see I picked a few more
1:14 that we're gonna play with up there. Let's just make sure that it works. I'll press, could have the transcript and this should change.
1:23 If you look over here, you can see if there is a transcript, the chat does change, but let's just hit enable chat right here to see that this works.
1:32 Look at that, preparing episode for AI and now it just means we're transcribing it. So as usual, this will take just a moment
1:41 and then we should get something cool here. Success, chat is ready. Refresh and now it says we can chat with the episode.
1:54 So a story of a man who made an extremely dubious decision to order a watch that he found on Instagram.
2:00 Well, let's ask a question here and just see what happens just to kind of round this out. What happened on Instagram? Based on the transcript provided,
2:24 not a fan of that because that's sort of leaking our implementation details, but let's carry on. It appears this episode of Reply All
2:35 discusses deceptive drop shipping schemes on Instagram. Specifically, a man named David fell for one such scheme
2:43 after seeing an ad on Instagram for a free watch. Oh, awesome, how cool is that? The transcript provides evidence
2:50 that these types of drop shipping schemes were successful using Instagram ads to mislead customers. Very, very cool.
3:01 One thing I wanna point out here is this UI is a little condensed, compact, I don't know. If you look at the response, it's actually paragraphs
3:11 and more space in here, but 'cause we put plain text into an HTML field, all of that was lost. So I told you there's a better way to do this
3:22 as we can come down here and say vm.setAnswer, chat.answer, and this will cure some of the things that were bugging me there.
3:31 So refresh, and because this question, not totally refresh, it's ask again. Because we asked this before, let's see what happens.
3:42 It shouldn't have to rerun it. Sure enough, it doesn't. Notice the based on the transcript provided is gone and now it's a, right to the answer.
3:51 It appears this episode of Reply All Discuss is deceptive, da da da, and here you can see it now has the concepts all broken out
3:58 with a summary at the end. Awesome, so, so good. So I'm impressed. This is really, this is impressive.
4:10 So let's just look real quick at what this set answer does. It's worth checking out. Up at the top, there are a couple of regular expressions.
4:19 And these are the ones that look for these misleading pieces. It says if the text starts with based on that dot dot,
4:28 we're going to just remove that bit. And then there's another one that we potentially could run across called transcripts.
4:34 Sometimes it thinks there's more than one if it's too long. And it's just gonna go down here when we say set answer
4:40 and just turns it and says for each regular expression, get rid of that junk, uppercase the starting character,
4:47 and then turn what are just text new lines into line breaks in HTML. So just so you know what's happening there.
4:56 And now it makes, I think it makes a big difference. It makes a real big difference. So awesome, awesome, awesome, awesome. I love it.

Talk Python's Mastodon Michael Kennedy's Mastodon