Skip to content

Commit

Permalink
use selected labels if attribute options is empty (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajasbansal authored Nov 21, 2024
1 parent 9a3edbb commit 8cb7f22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/autolabel/tasks/attribute_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ def _construct_attribute_json(
):
attribute_desc += " The output format should be all the labels separated by semicolons. For example: label1;label2;label3"

if "options" in attribute_dict and len(attribute_dict["options"]) > 0:
attribute_options = attribute_dict["options"]
if len(attribute_dict.get("options", [])) > 0 or (
selected_labels_map
and len(selected_labels_map.get(attribute_name, [])) > 0
):
attribute_options = attribute_dict.get("options", [])
if selected_labels_map and attribute_name in selected_labels_map:
attribute_options = selected_labels_map[attribute_name]
attribute_desc += f"\nOptions:\n{','.join(attribute_options)}"
Expand Down

0 comments on commit 8cb7f22

Please sign in to comment.