-
Notifications
You must be signed in to change notification settings - Fork 375
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
feat: add Ranking Question to the API #3232
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #3232 +/- ##
===========================================
+ Coverage 90.91% 91.03% +0.12%
===========================================
Files 215 218 +3
Lines 11304 11548 +244
===========================================
+ Hits 10277 10513 +236
- Misses 1027 1035 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait for the release branch before merging just to not disturb the release workflow
# Description This PR adds the required classes to create a Ranking Question and to validate their responses in the API. Additionally, I've refactor the `LabelSelectionQuestionSettingsOption` class to be named as `ValueTextQuestionSettingsOption`, as this same class can be used in the Ranking Question. Closes #3230 **Type of change** - [x] New feature (non-breaking change which adds functionality) - [x] Refactor **How Has This Been Tested** Unit tests have been added covering the creation of the Ranking Question as well as the validation of the submitted responses for this kind of question. **Checklist** - [x] I have merged the original branch into my forked branch - [ ] I added relevant documentation - [x] follows the style guidelines of this project - [x] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: Francisco Aranda <francis@argilla.io>
# Description This PR adds the required classes to create a Ranking Question and to validate their responses in the API. Additionally, I've refactor the `LabelSelectionQuestionSettingsOption` class to be named as `ValueTextQuestionSettingsOption`, as this same class can be used in the Ranking Question. Closes #3230 **Type of change** - [x] New feature (non-breaking change which adds functionality) - [x] Refactor **How Has This Been Tested** Unit tests have been added covering the creation of the Ranking Question as well as the validation of the submitted responses for this kind of question. **Checklist** - [x] I have merged the original branch into my forked branch - [ ] I added relevant documentation - [x] follows the style guidelines of this project - [x] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: Francisco Aranda <francis@argilla.io>
# Description This PR adds the required classes to create a Ranking Question and to validate their responses in the API. Additionally, I've refactor the `LabelSelectionQuestionSettingsOption` class to be named as `ValueTextQuestionSettingsOption`, as this same class can be used in the Ranking Question. Closes #3230 **Type of change** - [x] New feature (non-breaking change which adds functionality) - [x] Refactor **How Has This Been Tested** Unit tests have been added covering the creation of the Ranking Question as well as the validation of the submitted responses for this kind of question. **Checklist** - [x] I have merged the original branch into my forked branch - [ ] I added relevant documentation - [x] follows the style guidelines of this project - [x] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: Francisco Aranda <francis@argilla.io>
# Description This PR adds the required classes to create a Ranking Question and to validate their responses in the API. Additionally, I've refactor the `LabelSelectionQuestionSettingsOption` class to be named as `ValueTextQuestionSettingsOption`, as this same class can be used in the Ranking Question. Closes #3230 **Type of change** - [x] New feature (non-breaking change which adds functionality) - [x] Refactor **How Has This Been Tested** Unit tests have been added covering the creation of the Ranking Question as well as the validation of the submitted responses for this kind of question. **Checklist** - [x] I have merged the original branch into my forked branch - [ ] I added relevant documentation - [x] follows the style guidelines of this project - [x] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: Francisco Aranda <francis@argilla.io>
# Description This PR includes the `RankingQuestion`, introduced in #3232, in the Python client, to allow users to create datasets with `RankingQuestion`s and to submit responses for those too. ## Usage ```python import argilla as rg rg.init( api_url="<ARGILLA_API_URL>", api_key="<ARGILLA_API_KEY>, ) ds = rg.FeedbackDataset( fields=[ rg.TextField(name="prompt-1"), rg.TextField(name="prompt-2"), ], questions=[ rg.RankingQuestion( name="prompt-ranking", description="Rank the prompts from most to least natural.", required=True, values=["prompt-1", "prompt-2"], ), ], ) ds.add_records( [ rg.FeedbackRecord( fields={ "prompt-1": "Explain to a broad audience why banana bread is so fluffy.", "prompt-2": "Explain banana banana banana.", }, responses=[ { "values": { "prompt-ranking": {"value": [{"value": "prompt-1", "rank": 1}, {"value": "prompt-2", "rank": 2}]}, }, "status": "submitted" }, ], ), ] ) ds.push_to_argilla(name="new-dataset", workspace="new-workspace") ds = rg.FeedbackDataset.from_argilla(name="new-dataset", workspace="new-workspace") ds.push_to_huggingface(repo_id="<HUGGINGFACE_REPO_ID>", token="<HUGGINGFACE_TOKEN>") ds = rg.FeedbackDataset.from_huggingface(repo_id="<HUGGINGFACE_REPO_ID>", token="<HUGGINGFACE_TOKEN>") ``` **Type of change** - [X] New feature (non-breaking change which adds functionality) **How Has This Been Tested** - [X] Added unit tests to cover the new `RankingQuestion` **Checklist** - [X] I added relevant documentation - [X] follows the style guidelines of this project - [X] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [X] My changes generate no new warnings - [X] I have added tests that prove my fix is effective or that my feature works - [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK) (see text above) - [X] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: Francisco Aranda <francis@argilla.io> Co-authored-by: Gabriel Martin <gabriel@argilla.io>
Description
This PR adds the required classes to create a Ranking Question and to validate their responses in the API. Additionally, I've refactor the
LabelSelectionQuestionSettingsOption
class to be named asValueTextQuestionSettingsOption
, as this same class can be used in the Ranking Question.Closes #3230
Type of change
How Has This Been Tested
Unit tests have been added covering the creation of the Ranking Question as well as the validation of the submitted responses for this kind of question.
Checklist