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

Connected

Exercise

Ragas faithfulness evaluation

In this exercise, you'll evaluate the faithfulness of the RAG architecture you created at the end of Chapter 1. This chain has been re-defined for you and is available as through the variable chain.

You'll use the query provided, the chain's output, and the retrieved output to evaluate the faithfulness using the ragas framework.

The classes required have already been imported for you.

Instructions

100 XP
  • Query the retriever using the query provided and use a list comprehension to extract the document text from each retrieved document.
  • Define a ragas faithfulness chain.
  • Evaluate the faithfulness of the RAG chain available; you'll need to invoke the chain to generate the answer.