Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions eval_protocol/pytest/evaluation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,13 @@ def _log_eval_error(status: Status, rows: list[EvaluationRow] | None, passed: bo
to specially handle data_loaders here so we don't double
apply preprocess_fn.
"""
if preprocess_fn and not data_loaders:
data = preprocess_fn(data)
if preprocess_fn:
if not data_loaders:
data = preprocess_fn(data)
else:
raise ValueError(
"preprocess_fn should not be used with data_loaders. Pass preprocess_fn to data_loaders instead."
)

for row in data:
# generate a stable row_id for each row
Expand Down
2 changes: 1 addition & 1 deletion eval_protocol/quickstart/llm_judge_braintrust.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def braintrust_data_generator():
@evaluation_test(
data_loaders=DynamicDataLoader(
generators=[braintrust_data_generator],
preprocess_fn=multi_turn_assistant_to_ground_truth,
),
rollout_processor=SingleTurnRolloutProcessor(),
preprocess_fn=multi_turn_assistant_to_ground_truth,
max_concurrent_evaluations=2,
)
async def test_llm_judge(row: EvaluationRow) -> EvaluationRow:
Expand Down
2 changes: 1 addition & 1 deletion eval_protocol/quickstart/llm_judge_langfuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def langfuse_data_generator():
@evaluation_test(
data_loaders=DynamicDataLoader(
generators=[langfuse_data_generator],
preprocess_fn=multi_turn_assistant_to_ground_truth,
),
rollout_processor=SingleTurnRolloutProcessor(),
preprocess_fn=multi_turn_assistant_to_ground_truth,
max_concurrent_evaluations=2,
)
async def test_llm_judge(row: EvaluationRow) -> EvaluationRow:
Expand Down
1 change: 1 addition & 0 deletions eval_protocol/quickstart/llm_judge_langsmith.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def langsmith_data_generator() -> List[EvaluationRow]:
@evaluation_test(
data_loaders=DynamicDataLoader(
generators=[langsmith_data_generator],
preprocess_fn=multi_turn_assistant_to_ground_truth,
),
rollout_processor=SingleTurnRolloutProcessor(),
preprocess_fn=multi_turn_assistant_to_ground_truth,
Expand Down
2 changes: 1 addition & 1 deletion eval_protocol/quickstart/llm_judge_openai_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def openai_responses_data_generator():
@evaluation_test(
data_loaders=DynamicDataLoader(
generators=[openai_responses_data_generator],
preprocess_fn=multi_turn_assistant_to_ground_truth,
),
rollout_processor=SingleTurnRolloutProcessor(),
preprocess_fn=multi_turn_assistant_to_ground_truth,
max_concurrent_evaluations=2,
)
async def test_llm_judge_openai_responses(row: EvaluationRow) -> EvaluationRow:
Expand Down
Loading