Skip to content

Commit 7b893ad

Browse files
[FIX] Structure tool metrics error fix (#906)
Handled case where metrics is missing in the output Co-authored-by: Rahul Johny <[email protected]>
1 parent 5501972 commit 7b893ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/structure/src/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def run(
253253
structured_output_dict[SettingsKeys.METADATA] = metadata
254254
structured_output = json.dumps(structured_output_dict)
255255

256-
metrics = structured_output_dict[SettingsKeys.METRICS]
256+
metrics = structured_output_dict.get(SettingsKeys.METRICS, {})
257257
new_metrics = {}
258258
if tool_settings[SettingsKeys.ENABLE_SINGLE_PASS_EXTRACTION]:
259259
new_metrics = {
@@ -267,7 +267,8 @@ def run(
267267
for key in set(metrics)
268268
| set(index_metrics) # Union of keys from both dictionaries
269269
}
270-
structured_output_dict[SettingsKeys.METRICS] = new_metrics
270+
if new_metrics:
271+
structured_output_dict[SettingsKeys.METRICS] = new_metrics
271272
# Update GUI
272273
output_log = (
273274
f"## Result\n**NOTE:** In case of a deployed pipeline, the result would "

0 commit comments

Comments
 (0)