Home / Function/ _prepare_output() — langchain Function Reference

_prepare_output() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/scoring/eval_chain.py lines 322–329

    def _prepare_output(self, result: dict) -> dict:
        """Prepare the output."""
        parsed = result[self.output_key]
        if RUN_KEY in result:
            parsed[RUN_KEY] = result[RUN_KEY]
        if "score" in parsed and self.normalize_by is not None:
            parsed["score"] = parsed["score"] / self.normalize_by
        return parsed

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free