 Okay. This tutorial is where we really start to involve AI more heavily. If you haven't been following along so far in this project, we have created a Express and React framework for our front-end and back-end, and we are deploying that to Heroku, so it's visible on the web, and we are using the Open Podcast Index to search for podcasts, select episodes from those podcasts, and retrieve the MP3s from our chosen episode, and using OpenAI's Whisper API, we are transcribing that audio, and now in this tutorial, what we're going to do is harness the power of large language models to be able to ask questions about our podcast. So, this is the setup. What we're going to need is, we're going to need to take all of this text that comes through in the transcript, and we're going to divide it into chunks, so there's not too much to handle at any one given time, and then what we're going to do is we're going to generate embeddings, and embeddings are a vector representation of the text from our transcript. So, in order to store those embeddings, we need a vector store, and with that vector store, we can use a framework and in this case, we're going to use one from Facebook called Facebook AI similarity search face in order to be able to query that vector store and retrieve things that are most similar to what the user is searching for. So, in order to fetch the right content from the vector store, we need what's called a retriever, and to facilitate all of these different moving pieces, we're going to use a library called Lang chain. So, to recap, we need embeddings, and we're going to be using open AI's embeddings. We need a vector store. We need a similarity search method, and we're going to use face. We need a retriever, and we need a framework to orchestrate all of this, so we're using Lang chain. Let's get started. So, this is Lang chain's documentation, and I'm in the getting started set of an installation step. So, I've got an MPM module here that I need to install. Stop my servers here so I can run that install. Here we go, and it's showing me how to import it into my code. Again, we're using common.js, which it supports. So, I'm going to copy that. Put it here. Could say, then I mentioned we need something to split the text up. So, Lang chain provides these text splitters. We've got some documentation on how to do that, and let's look at the examples. We want a character text splitter. So, we're going to need to import that, and again, we're using common.js. So, it's going to be a require statement. So, from the Lang chain documentation for the character text splitter, we're going to copy this code. Below our AI import, we're going to import the text splitter. I'm not sure whether using this document doesn't seem to be used in the example that they give, but we want to convert this to a require, so it's going to look like character text splitter equals require Lang chain text splitter. And in that transcribe audio, I'm going to paste the rest of that code. So, we've got our splitter that we're creating. I'm going to leave the defaults here for the chunk size. Actually, no, I'm not. Let's make it about 256 characters with zero overlap. So, our separator will only be allowed to split on a space, so we won't get things being chopped off in the middle of a word. And then, our output is going to await the results of the splitter, creating documents from our transcription. And let's log the output there. So, let's go ahead and try that out. We can see that it is logging the output, but we hit an error when we are attempting to split. So, things don't always work out perfectly in AI land. I have a feeling this has something to do with this document import. It's in here, but they're not using it. There is another text splitter here, this recursive text splitter, and it does use the document module. So, I'm going to try that. Let's go back in here. These are actually part of the same package. So, we're going to use the recursive text splitter, and we're going to grab that document again, line chain document, and now let's copy this code. I need the text go, 256, 0, this output, and the page content is the transcription. We're not getting any errors this time, so it looks like we've got our page content in an object array. It's given us some metadata as this document object. So, let's move forward with that since we have no errors. And now we're going to create that vector store. So, I mentioned we were going to use face, and in here, we're going to need that MPM module. I'm going to install it, and let's copy these imports. Copilot catches on, and now we're going to use them down here, but let's see how we do that. So, this is creating the vector store from text, and it's passing this array of texts with their metadata. So, that kind of matches our format and new open AI embeddings, but we are not doing text. We created documents, so here it is from documents. So, let's try that. Do we need any other loaders? Don't think so. So, we've got our vector store with our AI embeddings, and now we want to create that retriever home row. Retriever goes vector store as retriever, and we didn't call it docs, we called it output, and let's log that retriever and just see if this worked. OK, so we have retriever created. This is a vector store retriever, and this is what it looks like. It's got our face store. I'm not sure what all that stuff does, but it looks like our retriever has been created, and this is the thing that's going to allow us to ask questions and retrieve context from this document via our QA interface that we're going to build. So, quick housekeeping thing, because I'm seeing over here our files are stacking up on our hard drive, so once we transcribe the audio, we can delete those files, and we do that with the file system's unlink command. So, file system unlink file path. Yeah, sure. If there's an error, let's log the error, and we'll respond with the status 500. So, that will handle that, and then I'll just delete these things so we can make sure that that is working as intended. OK, and then we need our LLM, kind of the most important thing here, which we haven't created yet. Actually, we'll do it after we successfully get a transcript. So, const LLM equals you open AI. OK, so we've got our LLM, and now we're going to use that via Lang chain. So, let's look up their documentation here. It's under chains, index-related trains, retrieval QA chain, and they've got an example here. And, again, we need this import, and we'll copy this code. It looks like it's making just a static query of that chain, so let's go ahead and do that for now, since we haven't built our interface to collect that input from the user. So, chain equals retrieval QA chain from LLM. We've got our model. We called it LLM, and we already did this, and called it retriever. Our response is going to await the chain, calling a question with a query of, let's just say, what is this podcast about? And it's got a lot of response. And I see one thing I did here. That's already been defined. Call it chain response, like the chain response. OK, it says it does not know. For some reason, it doesn't like our text, or it's not in a format that it wants. I believe it's because this is an object with text inside of it. So, transcription comes back as an object with a transcription.text. We want to pass the text, because it's understanding this to be in a different encoding. When it recognizes a string, it's going to assign the right of coding, I think. So let me try that. And now we've got a response. This podcast is about using AI-based services and the sustainability and environmental impact of training GPT-3. That's a decent summary of what this audio file is about, if you were to listen to it. So OK, I think we'll stop there. In the next tutorial, we will actually implement an interface to be able to ask whatever question you want, rather than hard coding a question. And we'll test out what those responses are like from our embeddings and from our large language model. So we'll see you in the next episode.