Skip to content

The agent engineering platform.

fix call _get_keys for custom_evaluator (#9763)

Buckler89a28e888b36ba
diff --git a/libs/langchain/langchain/smith/evaluation/runner_utils.py b/libs/langchain/langchain/smith/evaluation/runner_utils.py
index 438bc79140..f20f5cea4b 100644
--- a/libs/langchain/langchain/smith/evaluation/runner_utils.py
+++ b/libs/langchain/langchain/smith/evaluation/runner_utils.py
@@ -566,8 +566,13 @@ def _load_run_evaluators(
eval_llm = config.eval_llm or ChatOpenAI(model="gpt-4", temperature=0.0)
run_evaluators = []
input_key, prediction_key, reference_key = None, None, None
- if config.evaluators or any(
- [isinstance(e, EvaluatorType) for e in config.evaluators]
+ if (
+ config.evaluators
+ or any([isinstance(e, EvaluatorType) for e in config.evaluators])
+ or (
+ config.custom_evaluators
+ and any([isinstance(e, StringEvaluator) for e in config.custom_evaluators])
+ )
):
input_key, prediction_key, reference_key = _get_keys(
config, run_inputs, run_outputs, example_outputs