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

bug: FloatMetadataProperty: value is not a valid float when it is an rounded integer #4605

Conversation

sdiazlor
Copy link
Contributor

@sdiazlor sdiazlor commented Feb 27, 2024

Description

With the removal of this line, x.0 values will not be rounded so that it passes the FloatMetadataProperty validation. The error comes from the initial definition of the metadata property as float, but then casting and adding as value an integer.

NOTE: This fixes the bug error directly, although this question is still pending @alvarobartt:

However, from a usability perspective there is also the issue of not allowing for passing a rounded float like 1.0 to an IntegerMetadataProperty and perhaps also not an integer like1 to a FloatMetadataProperty.

Closes #4570

Type of change

(Please delete options that are not relevant. Remember to title the PR according to the type of change)

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested

(Please describe the tests that you ran to verify your changes. And ideally, reference tests)

  • Test A
  • Test B

Checklist

  • I followed the style guidelines of this project
  • I did a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. area: python sdk Indicates that an issue or pull request is related to the Python SDK team: backend Indicates that the issue or pull request is owned by the backend team type: bug Indicates an unexpected problem or unintended behavior labels Feb 27, 2024
@alvarobartt
Copy link
Member

Hi here @sdiazlor, thanks for the PR! w.r.t. @davidberenstein1957's question, I'm not sure, because if we have an IntegerMetadataProperty we should enforce the values to be int, not casting those to int i.e. 1.0 -> 1; same thing for the FloatMetadataProperty, which shouldn't cast to float by default. So IMO we can keep the casting within the text-descriptives integration while keeping argilla as is, also what do @jfcalvo and @frascuchon think about that?

Copy link

The URL of the deployed environment for this PR is https://argilla-quickstart-pr-4605-ki24f765kq-no.a.run.app

Copy link
Member

@davidberenstein1957 davidberenstein1957 left a comment

Choose a reason for hiding this comment

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

@sdiazlor could you also check if this work with the error Dani was experiencing?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 27, 2024
@davidberenstein1957
Copy link
Member

Hi here @sdiazlor, thanks for the PR! w.r.t. @davidberenstein1957's question, I'm not sure, because if we have an IntegerMetadataProperty we should enforce the values to be int, not casting those to int i.e. 1.0 -> 1; same thing for the FloatMetadataProperty, which shouldn't cast to float by default. So IMO we can keep the casting within the text-descriptives integration while keeping argilla as is, also what do @jfcalvo and @frascuchon think about that?

The proposed changed avoids the casting to int right? For me, it was more of a philosophical question about whether or not it made sense to allow for this, outside of this basic PR. I understand why but from a user experience it might be weird that it is impossible to add an 1.0 to an IntegerMetadataProperty or a 1 to a FloatMetadataProperty.

@sdiazlor
Copy link
Contributor Author

@sdiazlor could you also check if this work with the error Dani was experiencing?

@davidberenstein1957 Yes, I already did. And with a similar case (using to_argilla method), it didn't raise the validation issue. Below, you can see that the values are floats.
image

@dosubot dosubot bot added this to the v1.25.0 milestone Feb 27, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Feb 27, 2024
@davidberenstein1957 davidberenstein1957 merged commit 09f8da0 into develop Feb 27, 2024
6 of 7 checks passed
@davidberenstein1957 davidberenstein1957 deleted the bug/4570-bug-python-floatmetadataproperty-value-is-not-a-valid-float-when-it-is-an-rounded-integer branch February 27, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: python sdk Indicates that an issue or pull request is related to the Python SDK lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files. team: backend Indicates that the issue or pull request is owned by the backend team type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG-python] FloatMetadataProperty: value is not a valid float when it is an rounded integer
3 participants