Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the evaluator typing system to ensure that evaluator callbacks receive a BaseEvalDataPoint with a guaranteed test_case_id instead of a BaseDataPoint where the ID is optional. A helper function _as_eval_datapoint has been introduced to automatically generate a UUID for missing test case IDs without mutating the original dataset. Corresponding updates have been made across various plugins, tests, and samples. There are no review comments, so I have no feedback to provide.
|
@jeffdh5 ready for review when you have a moment. This mirrors the JS |
The evaluator stepper always assigns a test_case_id before invoking the callback, so type EvaluatorFn with BaseEvalDataPoint (required id) like JS does, and drop the `or ''` fallbacks in built-in evaluators. The dataset stays BaseDataPoint and is no longer mutated. Export BaseEvalDataPoint from genkit.evaluator. Fixes #5991 Co-authored-by: Cursor <cursoragent@cursor.com>
0e0ca82 to
9688047
Compare
|
@jeffdh5 @huangjeff5, could one of you take a look when you have a moment? I rebased this onto current
The |
|
Closing as obsolete: Python SDK development has moved to https://github.com/genkit-ai/genkit-python, and evaluators were removed from Python 1.0 in genkit-ai/genkit-python#37. |
Summary
EvaluatorFnto takeBaseEvalDataPoint(test_case_id: str) instead ofBaseDataPoint(test_case_idoptional), matching the JS evaluator API.BaseEvalDataPointin the stepper (UUID fill-in) before calling the callback, without mutating the datasetBaseDataPoint.genkit-evaluators, google-genai Vertex evaluators) and the evaluators sample to use the required id directly.Fixes genkit-ai/genkit-python#230
cc @jeffdh5
Test plan
pytestevaluator helper + veneer eval +genkit-evaluatorstests (10 passed)datapoint.test_case_idwithoutor ''under the typechecker