diff --git a/tools/structure/src/main.py b/tools/structure/src/main.py index 6d1b16287..e9c671ea1 100644 --- a/tools/structure/src/main.py +++ b/tools/structure/src/main.py @@ -253,7 +253,7 @@ def run( structured_output_dict[SettingsKeys.METADATA] = metadata structured_output = json.dumps(structured_output_dict) - metrics = structured_output_dict[SettingsKeys.METRICS] + metrics = structured_output_dict.get(SettingsKeys.METRICS, {}) new_metrics = {} if tool_settings[SettingsKeys.ENABLE_SINGLE_PASS_EXTRACTION]: new_metrics = { @@ -267,7 +267,8 @@ def run( for key in set(metrics) | set(index_metrics) # Union of keys from both dictionaries } - structured_output_dict[SettingsKeys.METRICS] = new_metrics + if new_metrics: + structured_output_dict[SettingsKeys.METRICS] = new_metrics # Update GUI output_log = ( f"## Result\n**NOTE:** In case of a deployed pipeline, the result would "