Submitting a question for RAG
So far, you have defined the chain, but you haven’t run it. So, let’s run the entire RAG pipeline in this one line, using a query you are feeding in:
rag_chain.invoke("What are the advantages of using RAG?")
As mentioned when stepping through what happens in the chain, "What are the advantages of using RAG?"
is the string we are going to pass into the chain to begin with. The first step in the chain expects this string as the question we discussed in the previous section as one of the two expected variables. In some applications, this may not be in the proper format and will need an extra function to prepare it, but for this application, it is already in the string format we are expecting, so we pass it right into that RunnablePassThrough()
object.
In the future, this prompt will include a query from a user interface, but for now, we will represent it as this variable string. Keep in mind that this is not the...