map() — langchain Function Reference
Architecture documentation for the map() function in string_run_evaluator.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD eeef200b_d96b_43d0_3074_30604390fe0c["map()"] 8b074a3f_8729_0bb7_fe7d_db473df331ce["LLMStringRunMapper"] eeef200b_d96b_43d0_3074_30604390fe0c -->|defined in| 8b074a3f_8729_0bb7_fe7d_db473df331ce 18ce5ec1_b967_6417_c994_9209a57f1c14["map()"] 18ce5ec1_b967_6417_c994_9209a57f1c14 -->|calls| eeef200b_d96b_43d0_3074_30604390fe0c b8c4bf91_87d7_ce69_1350_1bcdf1bccbbb["map()"] b8c4bf91_87d7_ce69_1350_1bcdf1bccbbb -->|calls| eeef200b_d96b_43d0_3074_30604390fe0c 975f5b09_3562_1764_4468_c7cb070bbfd3["map()"] 975f5b09_3562_1764_4468_c7cb070bbfd3 -->|calls| eeef200b_d96b_43d0_3074_30604390fe0c b15ccccb_1344_8d38_767a_922bd0d352ca["map()"] b15ccccb_1344_8d38_767a_922bd0d352ca -->|calls| eeef200b_d96b_43d0_3074_30604390fe0c 132c0c4d_93e7_fc60_9da8_46f58df87075["serialize_inputs()"] eeef200b_d96b_43d0_3074_30604390fe0c -->|calls| 132c0c4d_93e7_fc60_9da8_46f58df87075 df0ac8ee_9864_89bc_2b10_585085211119["serialize_outputs()"] eeef200b_d96b_43d0_3074_30604390fe0c -->|calls| df0ac8ee_9864_89bc_2b10_585085211119 b8c4bf91_87d7_ce69_1350_1bcdf1bccbbb["map()"] eeef200b_d96b_43d0_3074_30604390fe0c -->|calls| b8c4bf91_87d7_ce69_1350_1bcdf1bccbbb style eeef200b_d96b_43d0_3074_30604390fe0c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/smith/evaluation/string_run_evaluator.py lines 132–153
def map(self, run: Run) -> dict[str, str]:
"""Maps the Run to a dictionary."""
if run.run_type != "llm":
msg = "LLM RunMapper only supports LLM runs."
raise ValueError(msg)
if not run.outputs:
if run.error:
msg = f"Cannot evaluate errored LLM run {run.id}: {run.error}"
raise ValueError(msg)
msg = f"Run {run.id} has no outputs. Cannot evaluate this run."
raise ValueError(msg)
try:
inputs = self.serialize_inputs(run.inputs)
except Exception as e:
msg = f"Could not parse LM input from run inputs {run.inputs}"
raise ValueError(msg) from e
try:
output_ = self.serialize_outputs(run.outputs)
except Exception as e:
msg = f"Could not parse LM prediction from run outputs {run.outputs}"
raise ValueError(msg) from e
return {"input": inputs, "prediction": output_}
Domain
Subdomains
Source
Frequently Asked Questions
What does map() do?
map() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/smith/evaluation/string_run_evaluator.py.
Where is map() defined?
map() is defined in libs/langchain/langchain_classic/smith/evaluation/string_run_evaluator.py at line 132.
What does map() call?
map() calls 3 function(s): map, serialize_inputs, serialize_outputs.
What calls map()?
map() is called by 4 function(s): map, map, map, map.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free