|
25 | 25 | from .eval_case import InvocationEvents |
26 | 26 | from .eval_metrics import EvalMetric |
27 | 27 | from .eval_metrics import RubricsBasedCriterion |
| 28 | +from .llm_as_judge_utils import get_grounding_metadata_as_json_str |
28 | 29 | from .llm_as_judge_utils import get_text_from_content |
29 | 30 | from .llm_as_judge_utils import get_tool_calls_and_responses_as_json_str |
30 | 31 | from .llm_as_judge_utils import get_tool_declarations_as_json_str |
|
45 | 46 |
|
46 | 47 | # Key Evaluation Principles |
47 | 48 | Your evaluation must follow a two-part process: first, collect trusted evidence from the agent's work, and second, judge the final answer against it. |
48 | | -1. **Establish Trusted Evidence from Tool Calls**: You must first examine the agent's tool calls to determine if they are procedurally sound, meaning that the agent used the appropriate tools with logical parameters to address the user's prompt. |
49 | | - * Your ONLY sources of truth are the <user_prompt> and the direct output ('tool_response') from PROCEDURALLY SOUND tool calls found in the <response_steps>. Examples of procedural flaws include: |
| 49 | +1. **Establish Trusted Evidence from Tool Calls and Grounding**: You must first examine the agent's tool calls to determine if they are procedurally sound, meaning that the agent used the appropriate tools with logical parameters to address the user's prompt. |
| 50 | + * Your ONLY sources of truth are the <user_prompt>, the direct output ('tool_response') from PROCEDURALLY SOUND tool calls found in the <response_steps>, and model-supplied grounding metadata found in <grounding_metadata>. |
| 51 | + * Grounding metadata is trusted evidence for model-internal tools such as google_search whose raw search results may not appear as function tool responses. Examples of procedural flaws include: |
50 | 52 | * The agent failed to call a tool that will enable it to answer the user's prompt despite having all the necessary parameters to do so. |
51 | 53 | * The agent called the tool with incorrect or missing parameters. |
52 | 54 | * The agent called a tool that does not exist, or called a tool with a parameter that does not exist. |
|
222 | 224 | <response_steps> |
223 | 225 | {response_steps} |
224 | 226 | </response_steps> |
| 227 | + <grounding_metadata> |
| 228 | + {grounding_metadata} |
| 229 | + </grounding_metadata> |
225 | 230 | <final_answer> |
226 | 231 | {final_response} |
227 | 232 | </final_answer> |
@@ -303,6 +308,9 @@ def format_auto_rater_prompt( |
303 | 308 | response_steps = get_tool_calls_and_responses_as_json_str( |
304 | 309 | actual_invocation.intermediate_data |
305 | 310 | ) |
| 311 | + grounding_metadata = get_grounding_metadata_as_json_str( |
| 312 | + actual_invocation.intermediate_data |
| 313 | + ) |
306 | 314 |
|
307 | 315 | app_details = actual_invocation.app_details |
308 | 316 | if app_details: |
@@ -333,6 +341,7 @@ def format_auto_rater_prompt( |
333 | 341 | tool_declarations=tool_declarations, |
334 | 342 | user_input=user_input, |
335 | 343 | response_steps=response_steps, |
| 344 | + grounding_metadata=grounding_metadata, |
336 | 345 | final_response=final_response, |
337 | 346 | rubrics=rubrics_text, |
338 | 347 | ) |
|
0 commit comments