Introducing Confident Monitor

Role Adherence

Role Adherence is a multi-turn metric to determine if your chatbot adheres to a specified role

Overview

The role adherence metric is a multi-turn metric that uses LLM-as-a-judge to evaluate whether your chatbot consistently maintains its pre-determined role throughout the conversation.

Required Parameters

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

chatbot_rolestringRequired

The role your chatbot has to adhere to throughtout the conversation.

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

How Is It Calculated?

The role adherence metric iterates over each assistant turn and uses an LLM to check if the content adheres to the specified chatbot_role.


Role Adherence=Number of Assistant Turns that Adhered to Chatbot Role in ConversationTotal Number of Assistant Turns in Conversation\text{Role Adherence} = \frac{\text{Number of Assistant Turns that Adhered to Chatbot Role in Conversation}}{\text{Total Number of Assistant Turns in Conversation}}

The final score is the proportion of assisant turns that adhere to the role specified in the conversation.

Usage

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

  • Multi-turn E2E testing
  • Online and offline evals for traces and spans

Last updated on

Built byConfident AI