Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move serialization outside autolabel #929

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/autolabel/tasks/attribute_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def parse_llm_response(
llm_label = {}
for k, v in json5.loads(completion_text).items():
if isinstance(v, list) or isinstance(v, dict):
llm_label[k] = json.dumps(v)
llm_label[k] = v
else:
llm_label[k] = str(v)
Comment on lines +315 to 317
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just get rid of this branching ? why str(v) in other cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for cases when the value is a float or integer.

successfully_labeled = True
Expand All @@ -327,7 +327,7 @@ def parse_llm_response(
response.text[json_start : json_end + 1]
).items():
if isinstance(v, list) or isinstance(v, dict):
llm_label[k] = json.dumps(v)
llm_label[k] = v
else:
llm_label[k] = str(v)
successfully_labeled = True
Expand Down
Loading