chapter four

4 Augmenting LLMs with your own documents

 

In this chapter

  • understanding how retrieval-augmented generation (RAG) works
  • learning how to design the right RAG setup for your specific needs and documents
  • building and optimizing RAG flows using Langflow components

Our magic black box seems to have deep knowledge, but it’s, well, generic. When large language models (LLMs) are pretrained, they learn from a plethora of generic documents. As a consequence, their answers are typically based on general common sense. They tend to reflect an “average” of all that can be said on a specific topic (and they combine a lot of what has been generically said about that topic).

But is this always what we need? What if we want our GenAI assistant to answer questions about, let’s say, the opening hours of our small ice cream shop?

Is a generalist assistant able to help us in all cases? Not always, and here are a few reasons why:

RAG in a nutshell

Building a RAG system in Langflow

Taking RAG to the next level

What if we coded it?

Summary