Intent Classification
Overview
The Intent Classification metric evaluates the intent behind a given text to determine how well it aligns with one or more predefined expected intents.
IntentClassificationMetric
leverages the classifyIntent
function to perform this evaluation.
Methods
classifyIntent
Function
This function classifies the intent behind a given text and compares it against expected intents.
input
: The text to be classified.expectedIntents
: A list of expected intents to evaluate against.
It uses a transformer model to determine the intent and assesses the match against the expected intents based on confidence and similarity scores. The function returns a promise that resolves to an object containing the detected intent, its confidence score, and a similarity score with the expected intents.
IntentClassificationMetric
Class
IntentClassificationMetric
classifies and evaluates the intent behind text based on predefined expectations.
input
: The text to be classified.expectedIntents
: The expected intents against which the text will be evaluated.
The evaluateSteps
method invokes classifyIntent
and returns a detailed result, including a score and reasons. The score reflects how closely the detected intent matches the expected intents, with detailed reasons explaining the similarities and differences.