Agentic RAG
As discussed in Chapter 3, RAG pipelines serve to anchor responses to a knowledge base, allowing LLMs to generate responses based on actual, dynamic data. Figure 11.2 shows a standard RAG workflow as a series of steps.
Figure 11.2 - Example RAG pipeline
In real-world conversations, the standard chain workflow doesn’t always meet our needs. Sometimes, we may need to make multiple calls to the knowledge base to adequately answer a user’s question, or perhaps no calls at all. Agentic RAG addresses this challenge by allowing you to define an agent with a cognitive architecture capable of handling these scenarios, as shown in Figure 11.3.
Figure 11.3 - Agentic RAG simple workflow
To illustrate the construction of this type of agentic architecture, let’s begin by creating a knowledge base. In this scenario, we will create a clothing item catalog and use a generative model to populate it with data...