_prepare_input() — langchain Function Reference
Architecture documentation for the _prepare_input() function in string_run_evaluator.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2ca03f02_b9e1_8677_eda6_1008a8b4b7d4["_prepare_input()"] 96e174c1_4107_a88b_8d98_3f22e5d7fb20["StringRunEvaluatorChain"] 2ca03f02_b9e1_8677_eda6_1008a8b4b7d4 -->|defined in| 96e174c1_4107_a88b_8d98_3f22e5d7fb20 d3515eaf_6765_8d34_0615_40c3ff4f20d0["_call()"] d3515eaf_6765_8d34_0615_40c3ff4f20d0 -->|calls| 2ca03f02_b9e1_8677_eda6_1008a8b4b7d4 45efc57d_2b9e_96a6_a608_68913f941b40["_acall()"] 45efc57d_2b9e_96a6_a608_68913f941b40 -->|calls| 2ca03f02_b9e1_8677_eda6_1008a8b4b7d4 style 2ca03f02_b9e1_8677_eda6_1008a8b4b7d4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/smith/evaluation/string_run_evaluator.py lines 298–314
def _prepare_input(self, inputs: dict[str, Any]) -> dict[str, str]:
run: Run = inputs["run"]
example: Example | None = inputs.get("example")
evaluate_strings_inputs = self.run_mapper(run)
if not self.string_evaluator.requires_input:
# Hide warning about unused input
evaluate_strings_inputs.pop("input", None)
if example and self.example_mapper and self.string_evaluator.requires_reference:
evaluate_strings_inputs.update(self.example_mapper(example))
elif self.string_evaluator.requires_reference:
msg = (
f"Evaluator {self.name} requires an reference"
" example from the dataset,"
f" but none was provided for run {run.id}."
)
raise ValueError(msg)
return evaluate_strings_inputs
Domain
Subdomains
Source
Frequently Asked Questions
What does _prepare_input() do?
_prepare_input() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/smith/evaluation/string_run_evaluator.py.
Where is _prepare_input() defined?
_prepare_input() is defined in libs/langchain/langchain_classic/smith/evaluation/string_run_evaluator.py at line 298.
What calls _prepare_input()?
_prepare_input() is called by 2 function(s): _acall, _call.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free