LLMStringRunMapper#
- class langchain.smith.evaluation.string_run_evaluator.LLMStringRunMapper[source]#
Bases:
StringRunMapper
Extract items to evaluate from the run object.
- __call__(
- run: Run,
Maps the Run to a dictionary.
- Parameters:
run (Run)
- Return type:
dict[str, str]
- map(
- run: Run,
Maps the Run to a dictionary.
- Parameters:
run (Run)
- Return type:
dict[str, str]
- serialize_chat_messages(
- messages: list[dict],
Extract the input messages from the run.
- Parameters:
messages (list[dict])
- Return type:
str
- serialize_inputs(inputs: dict) str [source]#
Serialize inputs.
- Parameters:
inputs (dict) – The inputs from the run, expected to contain prompts or messages.
- Returns:
The serialized input text from the prompts or messages.
- Raises:
ValueError – If neither prompts nor messages are found in the inputs.
- Return type:
str
- serialize_outputs(outputs: dict) str [source]#
Serialize outputs.
- Parameters:
outputs (dict) – The outputs from the run, expected to contain generations.
- Returns:
The serialized output text from the first generation.
- Raises:
ValueError – If no generations are found in the outputs,
or if the generations are empty. –
- Return type:
str
- property output_keys: list[str]#
The keys to extract from the run.