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

[FEATURE] add __repr__ to argilla.settings._resource.SettingsProperties #5380

Open
davidberenstein1957 opened this issue Aug 5, 2024 · 9 comments · May be fixed by #5497
Open

[FEATURE] add __repr__ to argilla.settings._resource.SettingsProperties #5380

davidberenstein1957 opened this issue Aug 5, 2024 · 9 comments · May be fixed by #5497
Assignees
Labels
good first issue Indicates a good issue for first-time contributors status: help wanted Indicates that a maintainer wants help on an issue or pull request
Milestone

Comments

@davidberenstein1957
Copy link
Member

davidberenstein1957 commented Aug 5, 2024

Is your feature request related to a problem? Please describe.

These are used for error messaging but don't show the relevant information.

Describe the solution you'd like

I would like to see it as normal printed settings for the dataset.

Describe alternatives you've considered

NA.

Additional context

There might be other classes that need a __repr__.

@davidberenstein1957 davidberenstein1957 added good first issue Indicates a good issue for first-time contributors status: help wanted Indicates that a maintainer wants help on an issue or pull request labels Aug 5, 2024
@davidberenstein1957 davidberenstein1957 added this to the v2.1.0 milestone Aug 5, 2024
@phershbe
Copy link

phershbe commented Aug 6, 2024

Cool project!! I would like to work on this if it is okay. I am pretty inexperienced but this should be self-explanatory. I could check for other classes too but let me start with this. 🙂

@davidberenstein1957
Copy link
Member Author

Hi @phershbe, that would be very welcome. You can tak e a look here to see how you can contribute but feel free to ask for help when needed. https://docs.argilla.io/latest/community/contributor/

@davidberenstein1957
Copy link
Member Author

@phershbe are you still interested in tackling this?

@phershbe phershbe removed their assignment Aug 26, 2024
@phershbe
Copy link

@DavidBerenstein Sorry about this. Yeah I am, I spent quite a bit of time and went through the code base and checked out the __repr__ methods for different classes. I guess that in this case it is going to want to mention the properties but I didn't feel like I knew enough to ask a question and didn't want to submit a really sloppy pull request. I unassigned myself a few minutes ago, I will study whatever is in the pull request when it gets made. Sorry again about not letting you know before.

@nataliaElv nataliaElv modified the milestones: v2.1.0, v2.2.0 Sep 3, 2024
@bikash119
Copy link
Contributor

hi @davidberenstein1957 , can I take up this?

@bikash119
Copy link
Contributor

Hi @davidberenstein1957 : Can you please help me with replicating the scenarios. I was able to run all the unit tests without any failure. So, if I understand correctly, I will have to add tests to check the correctness of the code change.

@bikash119
Copy link
Contributor

bikash119 commented Sep 17, 2024

hi @davidberenstein1957, Request you to pls confirm if the below behavior is the expected behaviour for the below unit test.

def test_settings_repr(self):
        settings = rg.Settings(
            fields=[
                rg.TextField(name="text", title="text"),
                rg.ImageField(name="image", title="image"),
            ],
            metadata=[
                rg.FloatMetadataProperty("source"),
            ],
            questions=[
                rg.LabelQuestion(name="label", title="text", labels=["positive", "negative"]),
                #rg.MultiLabelQuestion(name="label", title="text", labels=["positive", "negative"]),
                rg.RatingQuestion(name="rating", title="text", values=[1, 2, 3, 4, 5]),
                rg.TextQuestion(name="text", title="text"),
                rg.SpanQuestion(name="span", 
                                title="text", field="text", 
                                labels=["Apparatus", "Method", "Machine", "Manufacture", "Design"],
                                visible_labels=3),
            ],
            vectors=[rg.VectorField(name="text", dimensions=3)],
        )
        print(settings.__repr__())
        assert (
            settings.__repr__() == f"Settings(guidelines=None, allow_extra_metadata=False, "
            "distribution=OverlapTaskDistribution(min_submitted=1), "
            f"fields={settings.fields}, questions={settings.questions}, vectors={settings.vectors}, metadata={settings.metadata})"
        )

Without fix

Settings(guidelines=None, allow_extra_metadata=False, distribution=OverlapTaskDistribution(min_submitted=1), fields=<argilla.settings._resource.SettingsProperties object at 0x7fd80ff7ea00>, questions=<argilla.settings._resource.QuestionsProperties object at 0x7fd80ff7e6d0>, vectors=<argilla.settings._resource.SettingsProperties object at 0x7fd80ff7edf0>, metadata=<argilla.settings._resource.SettingsProperties object at 0x7fd80ff7ea30>)

With fix

Settings(guidelines=None, allow_extra_metadata=False, distribution=OverlapTaskDistribution(min_submitted=1), fields=[TextField(name=text, title=text, description=None, type=text, required=True) , ImageField(name=image, title=image, description=None, type=image, required=True) ], questions=[LabelQuestion(name=label, title=text, description=None, type=label_selection, required=True) , RatingQuestion(name=rating, title=text, description=None, type=rating, required=True) , TextQuestion(name=text, title=text, description=None, type=text, required=True) , SpanQuestion(name=span, title=text, description=None, type=span, required=True) ], vectors=[VectorField(name=text, title=text, dimensions=3)], metadata=[FloatMetadataProperty(name=source, title=source, visible_for_annotators=True)])

@davidberenstein1957
Copy link
Member Author

That looks great!

@bikash119
Copy link
Contributor

Thanks @davidberenstein1957 , raising PR now.

@bikash119 bikash119 linked a pull request Sep 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors status: help wanted Indicates that a maintainer wants help on an issue or pull request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants