Home / Function/ _prepare_input() — langchain Function Reference

_prepare_input() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ae00f73a_3274_a24c_aed1_e45be85f0fdd["_prepare_input()"]
  6997d03c_6524_f97b_7017_b2f56540bc07["PairwiseStringEvalChain"]
  ae00f73a_3274_a24c_aed1_e45be85f0fdd -->|defined in| 6997d03c_6524_f97b_7017_b2f56540bc07
  69c11dee_1bd0_daca_16bd_24a2df0fec66["_evaluate_string_pairs()"]
  69c11dee_1bd0_daca_16bd_24a2df0fec66 -->|calls| ae00f73a_3274_a24c_aed1_e45be85f0fdd
  a98e0fa5_2b25_b62a_6940_98a36013ab00["_aevaluate_string_pairs()"]
  a98e0fa5_2b25_b62a_6940_98a36013ab00 -->|calls| ae00f73a_3274_a24c_aed1_e45be85f0fdd
  style ae00f73a_3274_a24c_aed1_e45be85f0fdd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/comparison/eval_chain.py lines 283–309

    def _prepare_input(
        self,
        prediction: str,
        prediction_b: str,
        input_: str | None,
        reference: str | None,
    ) -> dict:
        """Prepare the input for the chain.

        Args:
            prediction: The output string from the first model.
            prediction_b: The output string from the second model.
            input_: The input or task string.
            reference: The reference string, if any.

        Returns:
            The prepared input for the chain.

        """
        input_dict = {
            "prediction": prediction,
            "prediction_b": prediction_b,
            "input": input_,
        }
        if self.requires_reference:
            input_dict["reference"] = reference
        return input_dict

Domain

Subdomains

Frequently Asked Questions

What does _prepare_input() do?
_prepare_input() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/comparison/eval_chain.py.
Where is _prepare_input() defined?
_prepare_input() is defined in libs/langchain/langchain_classic/evaluation/comparison/eval_chain.py at line 283.
What calls _prepare_input()?
_prepare_input() is called by 2 function(s): _aevaluate_string_pairs, _evaluate_string_pairs.

Analyze Your Own Codebase

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

Try Supermodel Free