Probably the simplest ways to evaluate an LLM or runnable's string output against a reference label is by a simple string equivalence.
def exact_matching_evaluator():
evaluator = ExactMatchStringEvaluator()
evaluator = load_evaluator("exact_match")
evaluator.evaluate_strings(
prediction="1 LLM.",
reference="2 llm",
)
result = evaluator.evaluate_strings(
prediction="LangChain",
reference="langchain",
)
print("result is ",result)
references:
https://python.langchain.com/v0.1/docs/guides/productionization/evaluation/string/exact_match/
No comments:
Post a Comment