Home / Function/ _evaluate_strings() — langchain Function Reference

_evaluate_strings() — langchain Function Reference

Architecture documentation for the _evaluate_strings() function in eval_chain.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f9194a2f_4428_16e2_7306_921eac4fbfb5["_evaluate_strings()"]
  cb20f5c6_80c7_fbed_b351_e0b3c9587d96["QAEvalChain"]
  f9194a2f_4428_16e2_7306_921eac4fbfb5 -->|defined in| cb20f5c6_80c7_fbed_b351_e0b3c9587d96
  58783571_5c52_7ea5_40a4_0d8f9c7e8705["_evaluate_strings()"]
  58783571_5c52_7ea5_40a4_0d8f9c7e8705 -->|calls| f9194a2f_4428_16e2_7306_921eac4fbfb5
  c8ae767c_58c1_d764_8793_0d3dfcb69a27["_prepare_output()"]
  f9194a2f_4428_16e2_7306_921eac4fbfb5 -->|calls| c8ae767c_58c1_d764_8793_0d3dfcb69a27
  58783571_5c52_7ea5_40a4_0d8f9c7e8705["_evaluate_strings()"]
  f9194a2f_4428_16e2_7306_921eac4fbfb5 -->|calls| 58783571_5c52_7ea5_40a4_0d8f9c7e8705
  style f9194a2f_4428_16e2_7306_921eac4fbfb5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/qa/eval_chain.py lines 166–198

    def _evaluate_strings(
        self,
        *,
        prediction: str,
        reference: str | None = None,
        input: str | None = None,
        callbacks: Callbacks = None,
        include_run_info: bool = False,
        **kwargs: Any,
    ) -> dict:
        """Evaluate Chain or LLM output, based on optional input and label.

        Args:
            prediction: The LLM or chain prediction to evaluate.
            reference: The reference label to evaluate against.
            input: The input to consider during evaluation
            callbacks: The callbacks to use for tracing.
            include_run_info: Whether to include run info in the returned results.
            **kwargs: Additional keyword arguments, including callbacks, tags, etc.

        Returns:
            The evaluation results containing the score or value.
        """
        result = self(
            {
                "query": input,
                "answer": reference,
                "result": prediction,
            },
            callbacks=callbacks,
            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/qa/eval_chain.py.
Where is _evaluate_strings() defined?
_evaluate_strings() is defined in libs/langchain/langchain_classic/evaluation/qa/eval_chain.py at line 166.
What does _evaluate_strings() call?
_evaluate_strings() calls 2 function(s): _evaluate_strings, _prepare_output.
What calls _evaluate_strings()?
_evaluate_strings() is called by 1 function(s): _evaluate_strings.

Analyze Your Own Codebase

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

Try Supermodel Free