Home / Function/ _aevaluate_strings() — langchain Function Reference

_aevaluate_strings() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2a8e4ecd_7e90_d7b0_7098_e2e9ffbb9fb7["_aevaluate_strings()"]
  a58ec485_afe5_c733_6e70_92d4365f961c["ScoreStringEvalChain"]
  2a8e4ecd_7e90_d7b0_7098_e2e9ffbb9fb7 -->|defined in| a58ec485_afe5_c733_6e70_92d4365f961c
  ee557ec3_4797_27ed_1453_0e5e54776464["_prepare_input()"]
  2a8e4ecd_7e90_d7b0_7098_e2e9ffbb9fb7 -->|calls| ee557ec3_4797_27ed_1453_0e5e54776464
  ba07ee24_ae7f_f19c_7953_e0681af3166a["_prepare_output()"]
  2a8e4ecd_7e90_d7b0_7098_e2e9ffbb9fb7 -->|calls| ba07ee24_ae7f_f19c_7953_e0681af3166a
  style 2a8e4ecd_7e90_d7b0_7098_e2e9ffbb9fb7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/scoring/eval_chain.py lines 373–411

    async def _aevaluate_strings(
        self,
        *,
        prediction: str,
        reference: str | None = None,
        input: 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:
        """Asynchronously score the output string.

        Args:
            prediction: The output string from the first model.
            input: The input or task string.
            callbacks: The callbacks to use.
            tags: Optional tags to use.
            metadata: Optional metadata to use.
            include_run_info: Whether to include run information in the output.
            reference: The reference string, if any.
            **kwargs: Additional keyword arguments.

        Returns:
            `dict` containing:
                - reasoning: The reasoning for the preference.
                - score: A score between 1 and 10.

        """
        input_ = self._prepare_input(prediction, input, reference)
        result = await self.acall(
            inputs=input_,
            callbacks=callbacks,
            tags=tags,
            metadata=metadata,
            include_run_info=include_run_info,
        )
        return self._prepare_output(result)

Domain

Subdomains

Frequently Asked Questions

What does _aevaluate_strings() do?
_aevaluate_strings() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/scoring/eval_chain.py.
Where is _aevaluate_strings() defined?
_aevaluate_strings() is defined in libs/langchain/langchain_classic/evaluation/scoring/eval_chain.py at line 373.
What does _aevaluate_strings() call?
_aevaluate_strings() calls 2 function(s): _prepare_input, _prepare_output.

Analyze Your Own Codebase

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

Try Supermodel Free