argilla icon indicating copy to clipboard operation
argilla copied to clipboard

[BUG-python/deployment] `to_local()` returns description as None though it exists

Open kursathalat opened this issue 1 year ago • 1 comments

Describe the bug When the question has a description, it can be seen in the UI hovering over the i. But when using to_local(), it is shown as None.

Stacktrace and Code to create the bug

import argilla as rg
ds = rg.FeedbackDataset.from_argilla("my_dataset")
ds.questions[2].to_local()
RatingQuestion(name='rating_retrieved_document_1', title='Rate the relevance of the Retrieved Document 1 for the query (if present)', description=None, required=False, type='rating', values=[1, 2, 3, 4, 5, 6, 7])

Expected behavior The description to be shown in Python.

Environment: │ • Client version: 1.22.0 │ │ • Server version: 1.22.0-dev
│ • ElasticSearch version: 8.5.3

Additional context Add any other context about the problem here.

kursathalat avatar Jan 23 '24 12:01 kursathalat

🤖

Thank you for bringing this to our attention. Based on the information you've provided and the current functionality of the to_local() method in the Argilla codebase, it should indeed support the retrieval of question descriptions. This is evident from the code snippets where the description parameter is used in the creation of various question types such as TextQuestion, LabelQuestion, RankingQuestion, and RatingQuestion.

For instance, in the creation of a TextQuestion named "target", the description is set to "Translate the text." as shown in the code snippet below:

questions=[TextQuestion(name="target", description="Translate the text.", use_markdown=use_markdown)]

Similarly, for a LabelQuestion named "label", the description is set to "Choose one of the labels." as shown below:

questions=[LabelQuestion(name="label", labels=labels, description="Choose one of the labels.")]

These examples show that the to_local() method supports the retrieval of question descriptions. You can find these examples in the src/argilla/client/feedback/dataset/local/mixins.py file.

Furthermore, there is no difference in the way the to_local() method handles the description attribute for different question types in the Argilla codebase. In all the classes (RemoteTextQuestion, RemoteRatingQuestion, RemoteLabelQuestion, RemoteMultiLabelQuestion, RemoteRankingQuestion), the to_local() method simply returns a new instance of the respective question type with the description attribute set to self.description.

Here is the code for to_local() method in each class:

class RemoteTextQuestion(TextQuestion, RemoteSchema):
    def to_local(self) -> TextQuestion:
        return TextQuestion(
            ...
            description=self.description,
            ...
        )

class RemoteRatingQuestion(RatingQuestion, RemoteSchema):
    def to_local(self) -> RatingQuestion:
        return RatingQuestion(
            ...
            description=self.description,
            ...
        )

class RemoteLabelQuestion(LabelQuestion, RemoteSchema):
    def to_local(self) -> LabelQuestion:
        return LabelQuestion(
            ...
            description=self.description,
            ...
        )

class RemoteMultiLabelQuestion(MultiLabelQuestion, RemoteSchema):
    def to_local(self) -> MultiLabelQuestion:
        return MultiLabelQuestion(
            ...
            description=self.description,
            ...
        )

class RemoteRankingQuestion(RankingQuestion, RemoteSchema):
    def to_local(self) -> RankingQuestion:
        return RankingQuestion(
            ...
            description=self.description,
            ...
        )

In each case, the description attribute is handled in the same way. You can find these examples in the src/argilla/client/feedback/schemas/remote/questions.py file.

Given this, it's unclear why you're experiencing this issue. Could you please provide more information about the specific question that is causing this issue? For example, could you share the code you used to create this question? This will help us better understand the problem and find a solution.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Jan 23 '24 12:01 dosubot[bot]