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

fix: push_to_argilla and from_argilla consistency issues #3234

Merged
merged 10 commits into from
Jun 21, 2023

Conversation

alvarobartt
Copy link
Member

Description

This PR removes the unnecessary json.loads(field.json()) and json.loads(question.json()) as all the fields in those pydantic.BaseModels are JSON-serializable, so we can just provide the dict to the endpoint.

Besides that, we're also using the dict for FeedbackRecords, and then ensuring that the user_id in each response, which is an UUID and so on, not JSON-serializable, is properly serialized as a string in the add_records SDK function.

This also aligns both the FeedbackRecord logging in Argilla under the scenarios of pushing a new dataset and pushing records to an existing dataset.

Finally, also the from_argilla field and question re-construction is patched, as we were still using construct which was not respecting the Config set on those pydantic.BaseModels as construct implies Config.extra = 'allow'. So on, now that's patched too, and the FeedbackDataset retrieved via from_argilla is exactly the same one as the one logged via push_to_argilla and/or push_to_huggingface; as well as the argilla_id assignment when retrieving a FeedbackDataset.from_argilla once the argilla_id has already been set as cls.argilla_id = ....

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (change adding some improvement to an existing functionality)

How Has This Been Tested

  • Add unit tests for push_to_argilla to make sure the API doesn't throw any HTTP 422 when the payload contains UUIDs
  • Add unit tests for from_argilla to make sure the retrieve FeedbackDataset is consistent to what we should expect

Checklist

  • I have merged the original branch into my forked branch
  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

Copy link
Member

@gabrielmbmb gabrielmbmb left a comment

Choose a reason for hiding this comment

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

LGTM!

@alvarobartt alvarobartt merged commit d5632a3 into develop Jun 21, 2023
@alvarobartt alvarobartt deleted the fix/push-to-argilla-uuid branch June 21, 2023 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants