Relevancy
Overview
The Relevancy metric assesses how well the answer generated by a model addresses a posed question. This metric focuses on the contextual appropriateness of the response, measuring whether the answer is pertinent and adequately responds to the question’s intent.
RelevancyMetric
utilizes the evaluateRelevancy
function to determine the relevance of the answer to the question.
Methods
evaluateRelevancy
Function
This function evaluates the relevancy of the generated answer in response to a specific question.
input
: The question posed to the model.output
: The generated answer by the model.
The function checks the contextual alignment between the question and the answer, returning a promise that resolves to a boolean value indicating whether the answer is relevant. The relevancy is quantified on a scale from 0 to 1, where scores close to 1 indicate high relevance.
RelevancyMetric
Class
RelevancyMetric
evaluates how well an answer addresses the posed question, focusing on its relevance.
input
: The question posed to the model.output
: The generated answer by the model.
The evaluateSteps
method calls evaluateRelevancy
and provides a detailed result, including a score and reasons. The evaluation concludes with a score indicating high or low relevance based on the contextual appropriateness of the answer.