Repository navigation
fix(tier3): include ATIF content parts in judge answer evidence #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rng1995
merged 8 commits into
NVIDIA:main
from
YMuskrat:fix/atif-structured-answer-evidence
Oct 14, 2026
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
80dd652
fix(tier3): include ATIF content parts in host judge evidence
YMuskrat 1dfb020
fix(tier3): include ATIF content parts in verifier judge evidence
YMuskrat eb65a1b
test(tier3): cover structured answers and multimodal evidence parity
YMuskrat 6436ab8
docs: note ATIF structured-answer evidence correction
YMuskrat ba9fa4d
fix(tier3): retain text answer when final ATIF step is media-only
YMuskrat d9e81be
Merge NVIDIA main into PR #203 after review fixes
YMuskrat 748d3e3
Merge main into fix/atif-structured-answer-evidence
rng1995 ea748c9
Merge main into fix/atif-structured-answer-evidence
rng1995 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Schema-valid ATIF message parts must reach judge evidence and references.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import json | ||
| from types import ModuleType | ||
|
|
||
| import pytest | ||
|
|
||
| from skillevaluator.tier3.eval_core import atif_helpers | ||
|
|
||
|
|
||
| def _trajectory(messages: list) -> dict: | ||
| from harbor.models.trajectories.trajectory import Trajectory | ||
|
|
||
| return Trajectory.model_validate( | ||
| { | ||
| "schema_version": "ATIF-v1.8", | ||
| "agent": {"name": "test-agent", "version": "test"}, | ||
| "steps": [ | ||
| {"step_id": index, "source": "agent", "message": message} | ||
| for index, message in enumerate(messages, start=1) | ||
| ], | ||
| } | ||
| ).to_json_dict() | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| ("message", "expected"), | ||
| [ | ||
| ("The answer is 4.", "The answer is 4."), | ||
| ([{"type": "text", "text": "The answer is 4."}], "The answer is 4."), | ||
| ( | ||
| [{"type": "text", "text": "First line."}, {"type": "text", "text": "Second line."}], | ||
| "First line.\nSecond line.", | ||
| ), | ||
| ([], ""), | ||
| ([{"type": "text", "text": " "}], ""), | ||
| ], | ||
| ) | ||
| def test_message_content_reaches_all_text_extractors( | ||
| harbor_eval_template: ModuleType, | ||
| message: str | list, | ||
| expected: str, | ||
| ) -> None: | ||
| trajectory = _trajectory([message]) | ||
|
|
||
| assert atif_helpers.get_agent_text(trajectory) == expected | ||
| assert atif_helpers.get_final_response(trajectory) == expected | ||
| assert harbor_eval_template.get_agent_text(trajectory) == expected | ||
| assert harbor_eval_template._get_final_response(trajectory) == expected | ||
| assert atif_helpers.build_conversation_summary(trajectory, "question") == ( | ||
| harbor_eval_template.build_conversation_summary(trajectory, "question") | ||
| ) | ||
|
|
||
|
|
||
| def test_last_nonempty_structured_answer_reaches_all_judges_and_refs(harbor_eval_template: ModuleType) -> None: | ||
| trajectory = _trajectory(["Earlier answer.", [{"type": "text", "text": "The answer is 4."}], []]) | ||
|
|
||
| assert atif_helpers.get_final_response(trajectory) == "The answer is 4." | ||
| assert harbor_eval_template._get_final_response(trajectory) == "The answer is 4." | ||
| assert atif_helpers.get_agent_text(trajectory) == "Earlier answer.\nThe answer is 4." | ||
| assert "Agent: The answer is 4." in atif_helpers.build_conversation_summary(trajectory, "What is 2+2?") | ||
| shared = atif_helpers.build_metric_evidence_bundles(trajectory, "What is 2+2?", ground_truth="4") | ||
| verifier = harbor_eval_template.build_metric_evidence_bundles(trajectory, "What is 2+2?", ground_truth="4") | ||
| assert shared == verifier | ||
| for bundle in shared.values(): | ||
| assert "The answer is 4." in bundle["prompt_evidence"] | ||
| final_refs = [ref for ref in bundle["evidence_refs"] if ref["kind"] == "final_response"] | ||
| assert len(final_refs) == 1 | ||
| assert final_refs[0]["json_pointer"] == "/steps/1" | ||
| assert final_refs[0]["excerpt"] == "The answer is 4." | ||
|
|
||
|
|
||
| def test_multimodal_answer_uses_markers_without_media_paths(harbor_eval_template: ModuleType) -> None: | ||
| trajectory = _trajectory( | ||
| [ | ||
| [ | ||
| {"type": "text", "text": "Result attached."}, | ||
| {"type": "image", "source": {"media_type": "image/png", "path": "/private/image-result.png"}}, | ||
| {"type": "audio", "source": {"media_type": "audio/wav", "path": "/private/audio-result.wav"}}, | ||
| ] | ||
| ] | ||
| ) | ||
| expected = "Result attached.\n[image]\n[audio]" | ||
|
|
||
| assert atif_helpers.get_final_response(trajectory) == expected | ||
| assert harbor_eval_template._get_final_response(trajectory) == expected | ||
| shared = atif_helpers.build_metric_evidence_bundles(trajectory, "question") | ||
| verifier = harbor_eval_template.build_metric_evidence_bundles(trajectory, "question") | ||
| assert shared == verifier | ||
| for bundle in shared.values(): | ||
| assert expected in bundle["prompt_evidence"] | ||
| assert "/private/" not in json.dumps(bundle) |
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.
Uh oh!
There was an error while loading. Please reload this page.