String distance evaluators based on the RapidFuzz library.
Abstract base class for creating structured sequences of calls to components.
Chains should be used to encode a sequence of calls to components like models, document retrievers, other chains, etc., and provide a simple interface to this sequence.
Compare the output of two models (or two outputs of the same model).
String evaluator interface.
Grade, tag, or otherwise evaluate predictions relative to their inputs and/or reference labels.
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", )
Compute string edit distances between two predictions.