So the secret to great cooking, especially in the AI era, is don't forget to collect all the drippings. Turn that into gravy. That may sound a little bit disgusting, I know, but think of all the things you're generating, auto-completing with this magical LLM. It's all over the place. You have so much of it. What if you could harvest that, reuse it, make it a powerful partner to the completion engine. What if you could use the similarity engine that we talked about to be able to play with their gravy? Sounds a little bit abstract, let's get concrete and let's work with our gravy. Let's review inventory, design plugin, you did that. Did that, congrats. This is where we are right now. okay now what we're going to do is next up you did all that completion let's sort of make sure that sparkles here generate you generate it generate it generate it generate it generate it generate it generate it and it's kind of like drippings from the meals you've made and don't forget that you've used a lot of tokens to make all the information wouldn't it be nice if you could like soak it all up and reuse it somehow think about those two dimensions remember that there's the two engines there is the semantic completion engine you've used it a lot and now you want to use the semantic similarity engine and that is slightly different but so similar that you may not notice it as a AI chef that was in training like six months ago and now I can I can make a pretty good AI meal. I've been doing this for so long and I realized wait a lot of completion but. I'm getting a lot of similarity now. And what does that mean? It's hidden in this word that I find, if you are a super duper machine learning scientist, I apologize, but what the heck was this word embeddings? This word, I don't know, like this word, so much stuff in there. You can make a kernel with an embedding model. So what happened here? I got my hidden key stuff. I made a text completion service, but look, I made something called an embedding service. I use the text embedding service. Now, what happens when you do this is you do kind of like a double take, like we'd already had a service, completion service. Well, now you're adding another service. It is an embedding service. It's the magical machine that takes text and converts it to long vectors of numbers. And when you do this, you have two powers. You have the completion power and the similarity power. Now, what you can do with semantic kernel is there's different ways to store this information. And what we're gonna do is we're going to draw from the Chroma memory store. There's also a volatile memory store. There's a Pinecone, Weaviate, Azure Cognitive Search, a bunch of cool ways to kind of like hold on to whatever you generate with embeddings. And the way you add it is you do the following. Kernel dot register memory store, memory store equals Chroma memory store store. And you can close that and just run it, but what happens is the data that goes into that vector database goes away unless you say persist directory equals and give it a name. I'm using my memories to hold on to it okay made two nervous touch the kernel and made a chroma memory store that's persistent okay let's see this works look at that no errors didn't feel good so I did three things there I made a completion service. I made a similarity service also called embeddings and I attached a memory store to the kernel so I can hold on to vectors that I generate from the embedding conversion process. Just a bit of a caveat because we want this notebook to be useful to you. Let's say you run this and your memory store which is going to be stored in my memories directory starts to give you errors. So this is a. I'm gonna, let's see, delete dir equals true. If I run this, it just deleted the memory store folder. You might say like, wait, bring it back. Well, first off, let's just go back here and run this code above and no worries, it's there. And let's just ignore this code, walk over it, look aside, look aside. Okay, how you feel? We're here now. Okay, next we're gonna do is we're gonna put stuff into the memory store after the embedding vector has been created. You ready? Okay, so first off, let's get some data. You know, I like data, this data from the SWATs. I like the question and answer pairs because those are generally useful as information. Right now they're stored in native memory. They haven't gone anywhere. Okay, so let's now put all of those strengths, weaknesses, opportunities, and threats into memory. So I'm gonna add them to memory collection named SWAT. I'm gonna loop over the different arrays of strings and let's just neatly put them all into, there we go. So now it's sitting in the vector store. Fantastic. Okay. Now what? Let's now use the magnet. You know how much I love the magnet symbol? Magnet. Let's use a magnet. Okay. So I'm now going to look at this SWAT. The SWAT's all in vector memory, and I'm now going to ask questions of it. So, what are the easiest ways to make more money is the question I'm going to ask, and. I'm going to do the same kind of memory search async, I'm going to pluck out the different memory results, I'm also going to let you see the relevance score, remember 0 to 1, 1 is like perfect match, 0 is no match. Let's run that. And so now, it compares what are the easiest ways to make more money to what's in the vector store. And this is the first one that's coming up. It's saying catering potential. It's saying the annual food fair is coming. And so you see, it's basically sorted the most similar item to the query. It's kind of amazing, isn't it? Like, let's change that. Go ahead and change this. It's kind of like an amazing feeling. What are the easiest ways to save money? Let's see what it does with that one. It says partnerships. It says, worry about your competition. The cheese, don't forget the cheese. And so again, this is a magical machine now that takes your gravy drippings and uses it. And this kind of, remember left hand, right hand? This is your left hand doing amazing things. Okay, so let's go into a super long example. Now, I think you're kind of tired of that long example. So let me give you something a little easier because typing this is kind of hard. Here we go. Okay, let's read this code here for a second. All right, let's have a what if scenario. Well, how can the business owner save time? It's going to do the memory search. It's going to find the most similar memories. I'm gonna use a plugin, a plugin from the friendly consultant folder, plugin collection. And I'm gonna ask it to give me a presentation. I've made a plugin to make a presentation about anything I ask it to do. And long story short, set the context. And I ask it to run. Let's see how this works. So first off, it's used a similarity engine to find the most similar pieces of context. It's going to take all of that and give it to the prompt that is going to generate the presentation. So this is that example of retrieval augmented generation. The generated information is taken from the actual information stored in the vector database. So there you have it. This is a professional presentation from a consultant. The question is, how can the business owner save time? No problem, boss. Here are the three concerns. Here's how to address them individually. And this is what I brought to you. Kind of amazing? No, yes, no. And again, remember, you can change everything in these notebooks, like not just this one with other ones, and you can do entirely different analyses. Okay, so I wanna summarize here before we go to the next section, but I wanna congratulate you because you've now unlocked this very popular acronym called RAG. and you've accessed both the completion and similarity engines. Congratulations. You were able to bind similar things in the vector database. You were able to give them to a completion prompt and generate something on point. No hallucination needed. Doesn't that feel good? And now that you've done this, we're going to take you into the next chapter, which is all about something at a whole different level. Once you master plugins and similarity completion, all this world, world, you suddenly discover that it's time to make a plan, make an AI plan, generate a way to solve a goal instead of just sift through your plugins by hand. Have the AI go look through your giant Lego made of plugins. You don't have to go look through them. The AI can look through them. What's that like? Let's jump into plans.