Turn Contextual Relevancy
Turn Contextual Relevancy is a multi-turn metric used to evaluate a RAG retriever at each turn
Overview
The turn contextual relevancy metric is a multi-turn RAG metric that uses LLM-as-a-judge to evaluate whether the context retrieved at each turn of the conversation is relevant to what the user asked in that turn.
Required Parameters
These are the parameters you must supply in your test case to run evaluations for turn contextual relevancy metric:
turnslist of TurnRequired
A list of Turns as exchanges between user and assistant.
Parameters of Turn:
roleuser | assistantRequired
The role of the person speaking, it's either user or assistant
contentstringRequired
The content provided by the role for the turn
retrieval_contextlist of stringRequired
The retrieved context your retriever outputs for the turn sorted by their rank
How Is It Calculated?
The turn contextual relevancy metric slides a window over the turns, extracts the statements from each retrieval context node in the window using an LLM, then uses the same LLM to determine how many of those statements are relevant to the user content of that turn.
The final score is the average of the contextual relevancy scores of every assistant turn in the conversation.
Usage
To run the turn contextual relevancy metric on Confident AI, add it to a multi-turn metric collection. This will allow you to use turn contextual relevancy metric for:
- Multi-turn E2E testing
- Online and offline evals for traces and spans
Last updated on