Evaluation Parameters
To compute thecontextual_relevancy
metric, the following parameters are required:
input
: The user’s query or instruction.actual_output
: The response generated by your LLM application. (While not directly scored in this metric, it’s often part of the test case data).retrieval_context
: A list of documents or text chunks retrieved by your RAG system in response to theinput
.
How Is It Calculated?
This metric’s score is computed using an LLM-as-a-judge process. The LLM judge performs the following steps:- Statement Extraction: The LLM processes each document/node within the
retrieval_context
to identify individual statements or key pieces of information. - Relevance Classification: For each extracted statement from the
retrieval_context
, the LLM determines if that statement is relevant to the originalinput
. - Score Calculation: The final score is the ratio of relevant statements to the total number of statements extracted from the
retrieval_context
.
This metric was incorporated to the Galtea platform from the open source library deepeval, for more information you can also visit their documentation.