_evaluate_strings() — langchain Function Reference
Architecture documentation for the _evaluate_strings() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9ae50c25_b083_ff23_1a93_588e76d8e3f8["_evaluate_strings()"] 26b82b02_a8ed_6746_a5bb_47d69953b766["ExactMatchStringEvaluator"] 9ae50c25_b083_ff23_1a93_588e76d8e3f8 -->|defined in| 26b82b02_a8ed_6746_a5bb_47d69953b766 style 9ae50c25_b083_ff23_1a93_588e76d8e3f8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/evaluation/exact_match/base.py lines 75–101
def _evaluate_strings( # type: ignore[override]
self,
*,
prediction: str,
reference: str,
**kwargs: Any,
) -> dict:
"""Evaluate the exact match between the prediction and the reference.
Args:
prediction: The prediction string.
reference: The reference string.
**kwargs: Additional keyword arguments (not used).
Returns:
The evaluation results containing the score.
"""
if self.ignore_case:
prediction = prediction.lower()
reference = reference.lower()
if self.ignore_punctuation:
prediction = prediction.translate(str.maketrans("", "", string.punctuation))
reference = reference.translate(str.maketrans("", "", string.punctuation))
if self.ignore_numbers:
prediction = prediction.translate(str.maketrans("", "", string.digits))
reference = reference.translate(str.maketrans("", "", string.digits))
return {"score": int(prediction == reference)}
Domain
Subdomains
Source
Frequently Asked Questions
What does _evaluate_strings() do?
_evaluate_strings() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/exact_match/base.py.
Where is _evaluate_strings() defined?
_evaluate_strings() is defined in libs/langchain/langchain_classic/evaluation/exact_match/base.py at line 75.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free