Skip to content

Commit

Permalink
[FIX] Structure tool metrics error fix (#906)
Browse files Browse the repository at this point in the history
Handled case where metrics is missing in the output

Co-authored-by: Rahul Johny <[email protected]>
  • Loading branch information
Deepak-Kesavan and johnyrahul authored Dec 19, 2024
1 parent 5501972 commit 7b893ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/structure/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 "
Expand Down

0 comments on commit 7b893ad

Please sign in to comment.