Home / Function/ _evaluate_strings() — langchain Function Reference

_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
  3493c43b_b018_2a91_76fb_e9999735516a["_evaluate_strings()"]
  12a7d7c3_a442_0a1c_99c0_b2002afd1515["RegexMatchStringEvaluator"]
  3493c43b_b018_2a91_76fb_e9999735516a -->|defined in| 12a7d7c3_a442_0a1c_99c0_b2002afd1515
  style 3493c43b_b018_2a91_76fb_e9999735516a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/regex_match/base.py lines 70–88

    def _evaluate_strings(  # type: ignore[override]
        self,
        *,
        prediction: str,
        reference: str,
        **kwargs: Any,
    ) -> dict:
        """Evaluate the regex match between the prediction and the reference.

        Args:
            prediction: The prediction string.
            reference: The reference regex pattern.
            **kwargs: Additional keyword arguments (not used).

        Returns:
            The evaluation results containing the score.
        """
        match = re.match(reference, prediction, flags=self.flags)
        return {"score": int(bool(match))}

Domain

Subdomains

Frequently Asked Questions

What does _evaluate_strings() do?
_evaluate_strings() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/regex_match/base.py.
Where is _evaluate_strings() defined?
_evaluate_strings() is defined in libs/langchain/langchain_classic/evaluation/regex_match/base.py at line 70.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free