File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -442,7 +442,10 @@ def build_eval_set(
442442 _input = user_content .parts [0 ].text
443443 _expected_output = invocation .final_response .parts [0 ].text
444444
445- if invocation .intermediate_data .tool_uses :
445+ if (
446+ hasattr (invocation .intermediate_data , "tool_uses" )
447+ and invocation .intermediate_data .tool_uses
448+ ):
446449 for expected_tool_use in invocation .intermediate_data .tool_uses :
447450 _expected_tool .append (
448451 {
@@ -451,6 +454,26 @@ def build_eval_set(
451454 }
452455 )
453456
457+ elif (
458+ hasattr (invocation .intermediate_data , "invocation_events" )
459+ and invocation .intermediate_data .invocation_events
460+ ):
461+ for event in invocation .intermediate_data .invocation_events :
462+ if hasattr (event , "content" ) and hasattr (
463+ event .content , "parts"
464+ ):
465+ for part in event .content .parts :
466+ if (
467+ hasattr (part , "function_call" )
468+ and part .function_call is not None
469+ ):
470+ _expected_tool .append (
471+ {
472+ "name" : part .function_call .name ,
473+ "args" : part .function_call .args ,
474+ }
475+ )
476+
454477 eval_case_data .invocations .append (
455478 Invocation (
456479 invocation_id = invocation .invocation_id ,
Original file line number Diff line number Diff line change 1414
1515import time
1616from pathlib import Path
17-
17+ import os
1818from google .adk .cli .utils import evals
1919from google .adk .evaluation .eval_case import EvalCase , SessionInput
2020from google .adk .evaluation .local_eval_sets_manager import LocalEvalSetsManager
@@ -131,7 +131,8 @@ async def dump(
131131 dump_path = self ._get_eval_set_file_path (app_name , self .eval_set_id )
132132 Path (dump_path ).parent .mkdir (parents = True , exist_ok = True )
133133
134- self .create_eval_set (app_name = app_name , eval_set_id = self .eval_set_id )
134+ if not os .path .exists (dump_path ):
135+ self .create_eval_set (app_name = app_name , eval_set_id = self .eval_set_id )
135136
136137 await self .add_session_to_eval_set (
137138 app_name = app_name ,
You can’t perform that action at this time.
0 commit comments