1. Learn
  2. /
  3. Courses
  4. /
  5. Retrieval Augmented Generation (RAG) with LangChain

Connected

Exercise

Understanding BM25

Before you start integrating a BM25 sparse retriever into your RAG architecture, it's best to test it on some short strings to get a intuition for how the retriever selects the documents.

You've been provided with three strings that you'll use as the basis for your BM25 retriever. The functionality required for this exercise is already loaded for you.

Instructions

100 XP
  • Initialize the BM25 retriever from the documents; configuring it to retrieve three documents at a time.
  • Invoke the retriever on the query provided.
  • Print the page content of the first result.