String distance evaluators.
Compute string edit distances between two predictions.
Distance metric to use.
Compute string distances between the prediction and the reference.
from langchain_classic.evaluation import StringDistanceEvalChain evaluator = StringDistanceEvalChain() evaluator.evaluate_strings( prediction="Mindy is the CTO", reference="Mindy is the CEO", )
Using the load_evaluator function:
from langchain_classic.evaluation import load_evaluator evaluator = load_evaluator("string_distance") evaluator.evaluate_strings( prediction="The answer is three", reference="three", )