Launch Week 3: Five days of launches

Answer Relevancy

Answer relevancy is a single-turn metric to evaluate RAG generators

Overview

The answer relevancy metric uses LLM-as-a-judge to assess whether your RAG generator's output is relevant to the given input. It is a single-turn metric designed specifically for evaluating RAG QA specifically, and not general RAG.

Required Parameters

These are the parameters you must supply in your test case to run evaluations for answer relevancy metric:

inputstringRequired

The input query you supply to your RAG application.

actual_outputstringRequired

The final output your RAG application's generator generates.

How Is It Calculated?

The answer relevancy metric first breaks down the actual output of a test case into distinct statements, then calculates the proportion of those statements that are relevant to the given input.


Answer Relevancy=Number of Relevant StatementsTotal Number of Statements\text{Answer Relevancy} = \frac{\text{Number of Relevant Statements}}{\text{Total Number of Statements}}

The final score is the proportion of relevant statements found in the actual output.

Usage

To run the answer relevancy metric on Confident AI, add it to a single-turn metric collection. This will allow you to use answer relevancy metric for:

  • Single-turn E2E testing
  • Single-turn component-level testing
  • Online and offline evals for traces and spans

Last updated on

Built byConfident AI