diff --git a/tests/trace/test_evaluations.py b/tests/trace/test_evaluations.py index dbba17f5d88..96032653095 100644 --- a/tests/trace/test_evaluations.py +++ b/tests/trace/test_evaluations.py @@ -148,6 +148,19 @@ def is_op_ref_with_name(val: Any, name: str): expected_predict_ref = model_obj.val["predict"] assert is_op_ref_with_name(expected_predict_ref, "MyModel.predict") + predict_and_score_calls = [ + c + for (c, d) in flattened_calls + if op_name_from_ref(c.op_name) == "Evaluation.predict_and_score" + ] + assert len(predict_and_score_calls) == 3 + + # Assert that all the inputs are unique + inputs = set() + for call in predict_and_score_calls: + inputs.add(call.inputs["example"]) + assert len(inputs) == 3 + @weave.op def gpt_mocker(question: str): diff --git a/weave/trace/vals.py b/weave/trace/vals.py index 5a88363f924..f8f2f5a57fc 100644 --- a/weave/trace/vals.py +++ b/weave/trace/vals.py @@ -352,7 +352,7 @@ def _local_iter_with_remote_fallback(self) -> Generator[dict, None, None]: for ndx, row in enumerate(self._prefetched_rows): next_id_future = wc.future_executor.defer( - lambda: cached_table_ref.row_digests[ndx] + lambda ndx_closure=ndx: cached_table_ref.row_digests[ndx_closure] ) new_ref = self.ref.with_item(next_id_future) val = self._prefetched_rows[ndx]