It doesn't really have memory either of the last message if we were to just attach this to a large language model. So RAG, that's one way to help make this better. RAG stands for Retrieval Augmented Generation. And what this allows us to do is it allows us to attach this source of knowledge, our company information in terms of the products, frequently asked questions, policies, if we have any special promotions that are currently limited time. Here in the United States right now, we have July 4th coming up. So many companies are doing special discounts for products for July 4th promotion. So maybe we have temporary promotions that are going on. Maybe we have certain refund policies going on. Maybe we have product recalls for certain products. We want the large language model to know about all that. And RAG is a way for us to allow our large language model to essentially have access to current information that is relevant that the large language model otherwise would not know about. Because the large language model, as you know, it just knows about information that is trained on. And maybe the training cutoff date for the large language model was several months ago, and it would have no idea about the latest information about our products in our store.
So we're going to talk about how that happens. But essentially, when I ask a large language model a question, instead of it just responding to its pre-trained data, we can use Python to program it. So that the large language model will be classifying our prompt based on what are we asking and what kind of tools does it need to use in order to answer our question properly? And what kind of data sources would this large language model can be attached to so that it can also get the latest information that is current related to maybe our products or our discounts or refund policies? In this app, we're going to be using Bedrock model. So LangChain is going to use Bedrock model. It's going to be connected to Bedrock to connect to certain models. And also, it's going to use the Amazon Knowledge Base Retriever to retrieve from our Bedrock Knowledge Base where we're going to have a bunch of company product specific data, frequently asked questions, refund policies, things like that.
LangRaph allows us to build agents as a graph. So think about like a flow chart. Maybe there's conditions, right? So if I ask it a certain question, it might classify it as, is this question related to products or is this question related to like order, specific order information? So if I ask it, hey, what's going on with the curl cream for their hair care products? How do I use it? It's going to classify that message as, is it related? Should the large language model look at the tool related to searching up information about the products in our RAG system on Bedrock? Or should it, is this question related to an order that we need to help process a return for a customer? Well, for that type of question about a curl hair care product, and how do I use this curl cream? It'll classify that as intelligently as it can and it'll classify it as a product related question. And it'll use the tools relevant to searching for products and reply accordingly. Or if I ask it, hey, I need to return this shampoo. Well, it'll classify that message as, well, it's not really related to searching for products. It's related to handling the return. So instead, it'll use a different tool related to return policy so that it can search up return policy related information and maybe even involve a human in the loop to approve the refund based on certain criteria if it's eligible for refund. So you can think of each of these boxes as a node, right, where it's going to, it has one job.
Comments