You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the judge's reply cannot be parsed (it is not JSON, or the JSON is missing a required key), TunableRagEvaluator._evaluate_item_core scores the item 0.0 and writes "Error in evaluator from parsing judge LLM response." into reasoning, but leaves EvalOutputItem.error unset. The item then reads as an answer the judge scored 0, and num_errors and the Errors column of the nat eval summary do not count it. #2479 set error on items that fail inside BaseEvaluator for this reason, and the trajectory evaluator sets it for a judge reply it cannot read (and, since #2612, for a score outside the judge's 1 to 5 scale). This evaluator catches its parse error itself, so BaseEvaluator never sees it.
Fix: the parse-failure branch now sets error to Error in evaluator from parsing judge LLM response: <parser message>. The score stays 0.0, so average_score does not change, and reasoning is unchanged.
Tests in packages/nvidia_nat_langchain/tests/eval/test_tunable_rag_evaluate.py:
test_evaluate_partial_failure now also checks that the failed item has error set, the successful item does not, and num_errors is 1.
test_unparseable_judge_reply_is_an_error sends four items (a readable reply, a readable reply that scores 0, a reply that is not JSON, and JSON missing a required key) with default and with custom scoring, through evaluate and through evaluate_atif_fn. The two unreadable replies get error set, the two readable ones keep their scores (0.9 and 0.0) with no error, and num_errors is 2.
Both tests fail on develop (the new one in all four cases) with assert None is not None. With the fix, test_tunable_rag_evaluate.py: 20 passed. The full packages/nvidia_nat_langchain suite (pytest packages/nvidia_nat_langchain --run_slow in the package's uv sync --all-groups --all-extras environment, Python 3.12 on macOS arm64) passes on this branch and on develop.
With nat eval --skip_workflow on a three-item dataset whose judge (a local OpenAI-compatible stub) answers two items in prose, the summary shows Errors 0/3 on develop and 2/3 with this change; Avg Score is 0.27 on both. The yapf and ruff check pre-commit hooks pass on the changed files. Not run: the CI test legs on Linux (amd64 and arm64) and on Python 3.11 and 3.13, and the simple_web_query_eval and simple_calculator_eval example integration tests, which use this evaluator and need an NVIDIA API key for their hosted judge.
Not changed here: a reply that parses but whose score is not a number. With custom scoring it keeps that score and gets no error; with default scoring the item raises, which evaluate turns into an error item but evaluate_atif_fn does not catch, so this evaluator's whole ATIF-lane output is lost. That is the missing per-item catch reported in #2638, which also loses the output when a judge call fails.
We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
Any contribution which contains commits that are not Signed-Off will not be accepted.
When the PR is ready for review, new or existing tests cover these changes.
When the PR is ready for review, the documentation is up to date with these changes.
Summary by CodeRabbit
Bug Fixes
Evaluation results now include an error for responses that can’t be parsed, while preserving the existing zero score and failure reasoning.
Successful evaluations, including valid zero scores, remain error-free. Aggregate error counts now reflect failed items consistently across evaluation modes.
When the judge's reply cannot be parsed, `TunableRagEvaluator` scored the
item 0.0 but left `EvalOutputItem.error` unset, so the item looked like a
real score of 0 and `nat eval` counted no errors for it. Set `error` with
the parser's message, as `BaseEvaluator` does for failed items.
Signed-off-by: YusefSyed <[email protected]>
⚠️Deprecation Notice: NVIDIA NeMo Agent Toolkit has been deprecated as of October 2026 and will reach end of life (EOL) by end of year 2026. Depending on your needs, migrate to: NeMo Relay for observability, middleware, and governance. NeMo Helix for a unified CLI with evaluation, optimization, and hardening capabilities. NeMo Fabric for a consistent interface to run agent harnesses and custom agents.
We recommend completing your migration before the EOL date.
Pull request policy: Only bug fixes may be opened as pull requests.
No actionable comments were generated in the recent review.
Walkthrough
The tunable RAG evaluator now records judge-response parsing failures in EvalOutputItem.error while retaining a score of 0.0. Tests cover successful scores, parsing failures, and aggregate error counts across scoring modes and evaluation lanes.
Changes
Tunable RAG error reporting
Layer / File(s)
Summary
Record and validate parsing errors packages/nvidia_nat_langchain/src/nat/plugins/langchain/eval/tunable_rag_evaluator.py, packages/nvidia_nat_langchain/tests/eval/test_tunable_rag_evaluate.py
The evaluator records parsing exceptions in the item’s error field and retains the zero score and generic reasoning. Tests check that successful items have no error and that failed items contribute to the aggregate error count across default and custom scoring in legacy and ATIF lanes.
Judge replies that cannot be parsed now count as evaluation errors instead of looking like successful low scores. Valid scores, including a genuine zero, are unaffected. No actionable merge risk remains; the failing label check is a process matter, not a code issue.
Security architecture risk: Minimal · up to de6bb
Unreadable judge replies now populate an existing diagnostic field and count as evaluation errors. Scores and reasoning retain their previous behavior. No introduced or worsened risk affecting security, failure containment, rollback, or ownership was established.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix(eval): report unparseable tunable RAG judge replies as errors" matches the main change. The PR makes TunableRagEvaluator set EvalOutputItem.error when a judge reply is not JSON or lacks…
Linked Issues check
Issue #2640 requires that an unparseable judge reply keep score 0.0 and set EvalOutputItem.error. The reviewed diff for tunable_rag_evaluator.py (base 6a30e1f to head de6bba4) adds error = None be…
Out of Scope Changes check
The source change is limited to the parse-failure branch and the EvalOutputItem construction in TunableRagEvaluator._evaluate_item_core. Every changed line serves the #2640 objective. The test changes…
Full details: Title check
Explanation
The title "fix(eval): report unparseable tunable RAG judge replies as errors" matches the main change. The PR makes TunableRagEvaluator set EvalOutputItem.error when a judge reply is not JSON or lacks the required score key, while keeping the 0.0 score. The title is 65 characters, within the roughly 72-character limit. It uses a conventional-commit prefix rather than a strict imperative-mood sentence, but the verb "report" is imperative and the title is concise and descriptive.
Full details: Linked Issues check
Explanation
Issue #2640 requires that an unparseable judge reply keep score 0.0 and set EvalOutputItem.error. The reviewed diff for tunable_rag_evaluator.py (base 6a30e1f to head de6bba4) adds error = None before the parse attempt. The parse-failure except branch now sets error = f"Error in evaluator from parsing judge LLM response: {e}", keeps score = 0.0 and the original reasoning text, and passes error=error into EvalOutputItem. Successful parses leave error as None. The change applies to the shared _evaluate_item_core path, so both default and custom scoring and both lanes reach it. The PR tests (test_evaluate_partial_failure and test_unparseable_judge_reply_is_an_error) cover these cases per the PR description and change summary. I did not execute the tests. The source diff alone establishes the required behavior.
Full details: Out of Scope Changes check
Explanation
The source change is limited to the parse-failure branch and the EvalOutputItem construction in TunableRagEvaluator._evaluate_item_core. Every changed line serves the #2640 objective. The test changes in test_tunable_rag_evaluate.py support that objective. The PR explicitly leaves out nonnumeric-score replies and judge-call failures (#2638), and the diff does not change those paths. No unrelated changes are visible in the reviewed source diff.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
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
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.
Description
Closes #2640
When the judge's reply cannot be parsed (it is not JSON, or the JSON is missing a required key),
TunableRagEvaluator._evaluate_item_corescores the item 0.0 and writes "Error in evaluator from parsing judge LLM response." intoreasoning, but leavesEvalOutputItem.errorunset. The item then reads as an answer the judge scored 0, andnum_errorsand theErrorscolumn of thenat evalsummary do not count it. #2479 seterroron items that fail insideBaseEvaluatorfor this reason, and the trajectory evaluator sets it for a judge reply it cannot read (and, since #2612, for a score outside the judge's 1 to 5 scale). This evaluator catches its parse error itself, soBaseEvaluatornever sees it.Fix: the parse-failure branch now sets
errortoError in evaluator from parsing judge LLM response: <parser message>. The score stays 0.0, soaverage_scoredoes not change, andreasoningis unchanged.Tests in
packages/nvidia_nat_langchain/tests/eval/test_tunable_rag_evaluate.py:test_evaluate_partial_failurenow also checks that the failed item haserrorset, the successful item does not, andnum_errorsis 1.test_unparseable_judge_reply_is_an_errorsends four items (a readable reply, a readable reply that scores 0, a reply that is not JSON, and JSON missing a required key) with default and with custom scoring, throughevaluateand throughevaluate_atif_fn. The two unreadable replies geterrorset, the two readable ones keep their scores (0.9 and 0.0) with no error, andnum_errorsis 2.Both tests fail on
develop(the new one in all four cases) withassert None is not None. With the fix,test_tunable_rag_evaluate.py: 20 passed. The fullpackages/nvidia_nat_langchainsuite (pytest packages/nvidia_nat_langchain --run_slowin the package'suv sync --all-groups --all-extrasenvironment, Python 3.12 on macOS arm64) passes on this branch and ondevelop.With
nat eval --skip_workflowon a three-item dataset whose judge (a local OpenAI-compatible stub) answers two items in prose, the summary showsErrors 0/3ondevelopand2/3with this change;Avg Scoreis 0.27 on both. Theyapfandruff checkpre-commit hooks pass on the changed files. Not run: the CI test legs on Linux (amd64 and arm64) and on Python 3.11 and 3.13, and thesimple_web_query_evalandsimple_calculator_evalexample integration tests, which use this evaluator and need an NVIDIA API key for their hosted judge.Not changed here: a reply that parses but whose score is not a number. With custom scoring it keeps that score and gets no
error; with default scoring the item raises, whichevaluateturns into an error item butevaluate_atif_fndoes not catch, so this evaluator's whole ATIF-lane output is lost. That is the missing per-item catch reported in #2638, which also loses the output when a judge call fails.By Submitting this PR I confirm:
Summary by CodeRabbit