From 5cb35db921bf86b5ad0012046bd19fa7cc1e6abb Mon Sep 17 00:00:00 2001 From: Ankur Sharma Date: Thu, 30 Oct 2025 15:07:39 -0700 Subject: [PATCH] chore: Avoid rendering empty columns as part of detailed results rendering of eval results It is common for expected response and expected tool calls column to be empty for user simulated conversations. So, we don't render those. Co-authored-by: Ankur Sharma PiperOrigin-RevId: 826202867 --- src/google/adk/cli/cli_eval.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/google/adk/cli/cli_eval.py b/src/google/adk/cli/cli_eval.py index c8eda6f4..bc472e09 100644 --- a/src/google/adk/cli/cli_eval.py +++ b/src/google/adk/cli/cli_eval.py @@ -214,14 +214,16 @@ def pretty_print_eval_result(eval_result: EvalCaseResult): expected_invocation = per_invocation_result.expected_invocation row_data = { "prompt": _convert_content_to_text(actual_invocation.user_content), - "expected_response": _convert_content_to_text( - expected_invocation.final_response if expected_invocation else None + "expected_response": ( + _convert_content_to_text(expected_invocation.final_response) + if expected_invocation + else None ), "actual_response": _convert_content_to_text( actual_invocation.final_response ), - "expected_tool_calls": _convert_tool_calls_to_text( - expected_invocation.intermediate_data + "expected_tool_calls": ( + _convert_tool_calls_to_text(expected_invocation.intermediate_data) if expected_invocation else None ), @@ -252,11 +254,23 @@ def pretty_print_eval_result(eval_result: EvalCaseResult): ) click.echo("Invocation Details:") df = pd.DataFrame(data) + + # Identify columns where ALL values are exactly None + columns_to_keep = [] for col in df.columns: - if df[col].dtype == "object": - df[col] = df[col].str.wrap(40) - click.echo(tabulate(df, headers="keys", tablefmt="grid")) - click.echo("\n\n") # Few empty lines for visual clarity + # Check if all elements in the column are NOT None + if not df[col].apply(lambda x: x is None).all(): + columns_to_keep.append(col) + + # Select only the columns to keep + df_result = df[columns_to_keep] + + for col in df_result.columns: + if df_result[col].dtype == "object": + df_result[col] = df_result[col].str.wrap(40) + + click.echo(tabulate(df_result, headers="keys", tablefmt="grid")) + click.echo("\n\n") # Few empty lines for visual clarity def get_eval_sets_manager(