Skip to content

Commit

Permalink
pass through dataset row
Browse files Browse the repository at this point in the history
  • Loading branch information
tcapelle committed Oct 11, 2024
1 parent 0f16c19 commit a22c76b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions weave/flow/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,16 @@ async def predict_and_score(
score_signature = inspect.signature(score_fn)
score_arg_names = list(score_signature.parameters.keys())

# TODO: Check for input columns parameters in the signature of the scorer

if "model_output" not in score_arg_names:
raise OpCallError(
f"Scorer {scorer_name} must have a 'model_output' argument, to receive the output of the model function."
)

if isinstance(example, dict):
score_args = {k: v for k, v in example.items() if k in score_arg_names}
score_args.update({"dataset_row": example}) # TODO: investigate deduplication of dataset_row for performance
else:
if len(score_arg_names) == 2:
score_args = {score_arg_names[0]: example}
Expand Down

0 comments on commit a22c76b

Please sign in to comment.