fix(eval): handle failed inference results without invocations (cherry-pick) - #6565
Open
ftnext wants to merge 1 commit into
Open
fix(eval): handle failed inference results without invocations (cherry-pick)#6565ftnext wants to merge 1 commit into
ftnext wants to merge 1 commit into
Conversation
Merge google#5878 ## What changed - Return a failed `EvalCaseResult` when inference failed before producing any invocations. - Preserve the existing session lookup path when a failed inference still has a session id. - Add a regression test for `InferenceResult(status=FAILURE, inferences=None)`. - Clean up two existing lint issues in the touched eval test file so the local changed-file ruff check passes. This prevents the eval runner from replacing the original inference error with `TypeError: object of type 'NoneType' has no len()`. Fixes google#5876 ## To verify - `.\.venv\Scripts\python.exe -m py_compile src\google\adk\evaluation\local_eval_service.py tests\unittests\evaluation\test_local_eval_service.py` - `.\.venv\Scripts\python.exe -m pytest tests\unittests\evaluation\test_local_eval_service.py -k "failed_without_inferences or evaluate_single_inference_result" -q --basetemp .tmp\pytest` - `.\.venv\Scripts\python.exe -m ruff check src\google\adk\evaluation\local_eval_service.py tests\unittests\evaluation\test_local_eval_service.py` - `.\.venv\Scripts\python.exe -m pyink --check src\google\adk\evaluation\local_eval_service.py tests\unittests\evaluation\test_local_eval_service.py` - `git diff --check` Co-authored-by: George Weale <gweale@google.com> COPYBARA_INTEGRATE_REVIEW=google#5878 from he-yufeng:fix/eval-failed-inference-none 5ed777d PiperOrigin-RevId: 933176248 (cherry picked from commit 9a6cf60)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
This PR backports 9a6cf60 from
maintov1.When inference fails before producing invocations,
InferenceResult.inferencesremainsNone. The v1 implementation subsequently callslen(inference_result.inferences), replacing the original inference error with:The backported guard returns an
EvalCaseResultwithfinal_eval_status=EvalStatus.FAILEDand allows the remaining evaluation cases to continue.Testing Plan
Unit Tests:
Focused tests:
pytest tests/unittests/evaluation/test_local_eval_service.py -k "failed_without_inferences or evaluate_single_inference_result" -qResult:
Additional checks:
ruff check: passedpyink --check: passedManual End-to-End (E2E) Tests:
Not run. This is a direct backport of the existing
mainfix, with focused regression coverage for the failed-inference path.Checklist
Additional context
The original commit was cherry-picked with
-xand applied to the currentv1branch without conflicts.