Skip to content

Commit a4c9387

Browse files
fix: make _EvalMetricResultWithInvocation.expected_invocation Optional for conversation_scenario support (#5215)
Co-authored-by: Ankur <ankusharma@google.com>
1 parent 494c360 commit a4c9387

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/google/adk/evaluation/agent_evaluator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class _EvalMetricResultWithInvocation(BaseModel):
9090
"""
9191

9292
actual_invocation: Invocation
93-
expected_invocation: Invocation
93+
expected_invocation: Optional[Invocation] = None
9494
eval_metric_result: EvalMetricResult
9595

9696

@@ -438,15 +438,21 @@ def _print_details(
438438
"threshold": threshold,
439439
"prompt": AgentEvaluator._convert_content_to_text(
440440
per_invocation_result.expected_invocation.user_content
441+
if per_invocation_result.expected_invocation
442+
else per_invocation_result.actual_invocation.user_content
441443
),
442444
"expected_response": AgentEvaluator._convert_content_to_text(
443445
per_invocation_result.expected_invocation.final_response
446+
if per_invocation_result.expected_invocation
447+
else None
444448
),
445449
"actual_response": AgentEvaluator._convert_content_to_text(
446450
per_invocation_result.actual_invocation.final_response
447451
),
448452
"expected_tool_calls": AgentEvaluator._convert_tool_calls_to_text(
449453
per_invocation_result.expected_invocation.intermediate_data
454+
if per_invocation_result.expected_invocation
455+
else None
450456
),
451457
"actual_tool_calls": AgentEvaluator._convert_tool_calls_to_text(
452458
per_invocation_result.actual_invocation.intermediate_data

0 commit comments

Comments
 (0)