mirror of
https://github.com/hwchase17/langchain.git
synced 2026-01-13 11:58:23 +00:00
Add string example mapper (#9086)
Now that we accept any runnable or arbitrary function to evaluate, we don't always look up the input keys. If an evaluator requires references, we should try to infer if there's one key present. We only have delayed validation here but it's better than nothing
This commit is contained in:
@@ -375,7 +375,11 @@ class StringRunEvaluatorChain(Chain, RunEvaluator):
|
||||
)
|
||||
|
||||
# Configure how example rows are fed as a reference string to the evaluator
|
||||
if reference_key is not None or data_type in (DataType.llm, DataType.chat):
|
||||
if (
|
||||
reference_key is not None
|
||||
or data_type in (DataType.llm, DataType.chat)
|
||||
or evaluator.requires_reference
|
||||
):
|
||||
example_mapper = StringExampleMapper(reference_key=reference_key)
|
||||
elif evaluator.requires_reference:
|
||||
raise ValueError(
|
||||
|
||||
Reference in New Issue
Block a user