langchain.evaluation.exact_match.base.ExactMatchStringEvaluator¶
- class langchain.evaluation.exact_match.base.ExactMatchStringEvaluator(*, ignore_case: bool = False, ignore_punctuation: bool = False, ignore_numbers: bool = False, **kwargs: Any)[source]¶
- 计算预测和参考之间的精确匹配。 - 示例 - >>> evaluator = ExactMatchChain() >>> evaluator.evaluate_strings( prediction="Mindy is the CTO", reference="Mindy is the CTO", ) # This will return {'score': 1.0} - >>> evaluator.evaluate_strings( prediction="Mindy is the CTO", reference="Mindy is the CEO", ) # This will return {'score': 0.0} - 属性 - evaluation_name- 获取评估名称。 - input_keys- 获取输入键。 - requires_input- 此评估器不需要输入。 - requires_reference- 此评估器需要一个参考。 - 方法 - __init__(^[, ignore_case, ...])- aevaluate_strings(^[, prediction[, ...]])- 异步评估链或LLM输出,基于可选的输入和标签。 - evaluate_strings(^[, prediction[, reference, ...]])- 基于可选的输入和标签评估链或LLM输出。 - 参数
- ignore_case (bool) – 
- ignore_punctuation (bool) – 
- ignore_numbers (bool) – 
- kwargs (Any) – 
 
 - __init__(*, ignore_case: bool = False, ignore_punctuation: bool = False, ignore_numbers: bool = False, **kwargs: Any)[source]¶
- 参数
- ignore_case (bool) – 
- ignore_punctuation (bool) – 
- ignore_numbers (bool) – 
- kwargs (Any) – 
 
 
 - async aevaluate_strings(*, prediction: str, reference: Optional[str] = None, input: Optional[str] = None, **kwargs: Any) dict¶
- 异步评估链或LLM输出,基于可选的输入和标签。 - 参数
- prediction (str) – 待评估的LLM或链预测。 
- reference (Optional[str], optional) – 评估时使用的参考标签。 
- input (Optional[str], optional) – 评估时考虑的输入。 
- kwargs (Any) – 其他关键字参数,包括回调、标签等。 
 
- 返回值
- 包含得分或值的评估结果。 
- 返回类型
- dict 
 
 - evaluate_strings(*, prediction: str, reference: Optional[str] = None, input: Optional[str] = None, **kwargs: Any) dict¶
- 基于可选的输入和标签评估链或LLM输出。 - 参数
- prediction (str) – 待评估的LLM或链预测。 
- reference (Optional[str], optional) – 评估时使用的参考标签。 
- input (Optional[str], optional) – 评估时考虑的输入。 
- kwargs (Any) – 其他关键字参数,包括回调、标签等。 
 
- 返回值
- 包含得分或值的评估结果。 
- 返回类型
- dict