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
  40cf3d13_49ba_2eae_ecb6_31da12ed07a7["_evaluate_strings()"]
  e6333041_afe4_af13_ee74_a7ac732f022f["EmbeddingDistanceEvalChain"]
  40cf3d13_49ba_2eae_ecb6_31da12ed07a7 -->|defined in| e6333041_afe4_af13_ee74_a7ac732f022f
  fbbf6b20_ebdc_5396_8597_95686297918e["_prepare_output()"]
  40cf3d13_49ba_2eae_ecb6_31da12ed07a7 -->|calls| fbbf6b20_ebdc_5396_8597_95686297918e
  style 40cf3d13_49ba_2eae_ecb6_31da12ed07a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/embedding_distance/base.py lines 434–467

    def _evaluate_strings(
        self,
        *,
        prediction: str,
        reference: str | None = None,
        callbacks: Callbacks = None,
        tags: list[str] | None = None,
        metadata: dict[str, Any] | None = None,
        include_run_info: bool = False,
        **kwargs: Any,
    ) -> dict:
        """Evaluate the embedding distance between a prediction and reference.

        Args:
            prediction: The output string from the first model.
            reference: The output string from the second model.
            callbacks: The callbacks to use.
            tags: The tags to apply.
            metadata: The metadata to use.
            include_run_info: Whether to include run information in the output.
            **kwargs: Additional keyword arguments.

        Returns:
            `dict` containing:
                - score: The embedding distance between the two predictions.
        """
        result = self(
            inputs={"prediction": prediction, "reference": reference},
            callbacks=callbacks,
            tags=tags,
            metadata=metadata,
            include_run_info=include_run_info,
        )
        return self._prepare_output(result)

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/embedding_distance/base.py.
Where is _evaluate_strings() defined?
_evaluate_strings() is defined in libs/langchain/langchain_classic/evaluation/embedding_distance/base.py at line 434.
What does _evaluate_strings() call?
_evaluate_strings() calls 1 function(s): _prepare_output.

Analyze Your Own Codebase

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

Try Supermodel Free