fix(evaluation): exclude thought parts from text extraction across criteria - #7117
Open
james-auror wants to merge 1 commit into
Open
james-auror wants to merge 1 commit into
james-auror wants to merge 1 commit into
Conversation
…iteria Every text-extraction site in evaluation/ filtered on `if part.text`, which was equivalent to visible model output before thinking models became routine. It no longer is: parts marked `thought=True` are text parts, so agent reasoning leaked into scoring, judge prompts, and hallucination grounding checks. Adds get_text_parts() alongside the existing get_text_from_content() in llm_as_judge_utils.py as the single source of truth, both now excluding thought parts. Routes every criterion through it: three private copies of the same unfiltered body (final_response_match_v1, vertex_ai_eval_facade, agent_evaluator) now delegate to it, and five inline extraction sites (hallucinations_v1, rubric_based_multi_turn_trajectory_evaluator) call the new helper directly. hallucinations_v1 was the worst affected: each thought part became its own EvaluationStep, so an agent's private reasoning was checked for grounding against tool outputs as if it were a claim made to the user. Generalizes the fix from google#7091, which covered final_response_match_v1 alone. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
I am working with our legal team to get the CLA signed. |
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.
Overview
Every text-extraction site in
evaluation/filtered parts withif part.text, which was equivalent to "visible model output" before thinking models became routine. It no longer is: parts markedthought=Trueare text parts, so agent reasoning leaks into ROUGE scoring, judge prompts, and hallucination grounding checks. Inhallucinations_v1, each thought part became its own evaluation step, so an agent's private reasoning was checked for grounding against tool outputs as if it were a claim made to the user.This generalizes the fix in #7091 (credit to @MrCapricornLiu for the diagnosis and regression-test approach) from
final_response_match_v1alone to every criterion that extracts text fromContent.Changes
get_text_parts()alongside the existingget_text_from_content()inllm_as_judge_utils.pyas the shared, thought-filtering source of truth for text extraction.final_response_match_v1,vertex_ai_eval_facade, andagent_evaluatoreach had a private copy of the same unfiltered extraction body — these now delegate toget_text_from_content().hallucinations_v1andrubric_based_multi_turn_trajectory_evaluatorhad inline extraction at five call sites — these now callget_text_parts()directly.final_response_match_v2,rubric_based_final_response_quality_v1,rubric_based_tool_use_quality_v1, andrubric_based_evaluatoralready routed through the shared helper, so they're fixed by the helper change alone.🤖 Generated with Claude Code