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] Update responses of RemoteFeedbackRecords #4328

Closed
plaguss opened this issue Nov 27, 2023 · 6 comments
Closed

[FEATURE] Update responses of RemoteFeedbackRecords #4328

plaguss opened this issue Nov 27, 2023 · 6 comments
Assignees
Labels
area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints area: python sdk Indicates that an issue or pull request is related to the Python SDK language: python Pull requests or issues that update Python code status: help wanted Indicates that a maintainer wants help on an issue or pull request status: stale Indicates that there is no activity on an issue or pull request team: backend Indicates that the issue or pull request is owned by the backend team type: enhancement Indicates new feature requests

Comments

@plaguss
Copy link
Contributor

plaguss commented Nov 27, 2023

Is your feature request related to a problem? Please describe.
We cannot update the responses of RemoteFeedbackRecords.

Describe the solution you'd like
I would like to update the responses of RemoteFeedbackRecords using the current API.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Running the following code should result in the records' responses being updated, but it doesn't:

dataset = rg.FeedbackDataset.from_argilla("end2end_textclassification")
dataset_org = load_dataset("ag_news", split="train[:1000]")
id2label = {0: "World", 1: "Sports", 2: "Business", 3: "Sci/Tech"}
mapped_labels = [id2label[label] for label in dataset_org["label"]] 

modified_records = [record for record in dataset.records]

for index, record in enumerate(modified_records):
    record.responses = [
        {
            "values":{
                "label":{
                    "value": mapped_labels[index],
                }
            },
            "inserted_at": datetime.now(),
            "updated_at": datetime.now(),
        }
    ]
    #print(record.responses)
dataset.update_records(modified_records)

The update is done here

Copy link

dosubot bot commented Nov 27, 2023

🤖

Hello @plaguss,

Nice to meet you! I'm Dosu, a bot here to assist you with your issues and queries regarding the Argilla repository. While we're waiting for a human maintainer, I'm here to help you troubleshoot bugs, answer questions, and guide you on becoming a contributor. Let's work on this together!

Thank you for your feature request. Currently, the update_record function in the Argilla repository does not support updating the responses field of RemoteFeedbackRecords through the API. The function currently only supports updating the metadata, suggestions, and vectors fields of a record. Here is the relevant code:

def update_record(
    client: httpx.Client,
    id: Union[str, UUID],
    data: Dict[str, Any],
) -> Response[Union[FeedbackItemModel, ErrorMessage, HTTPValidationError]]:
    ...
    body = {}
    if "metadata" in data:
        body["metadata"] = data["metadata"]
    if "suggestions" in data:
        body["suggestions"] = data["suggestions"]
    if "vectors" in data:
        body["vectors"] = data["vectors"]
    ...

As you can see, the function checks if metadata, suggestions, and vectors are present in the data dictionary and if they are, it adds them to the body dictionary which is then sent in the PATCH request. There is no check or handling for a responses field.

This is something that could be considered for a future update of the Argilla repository. However, as of the current version (v1.19.0), this feature is not available.

You can find the update_record function in the src/argilla/client/sdk/v1/records/api.py file in the Argilla repository.

Sources

@dosubot dosubot bot added area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints area: python sdk Indicates that an issue or pull request is related to the Python SDK language: python Pull requests or issues that update Python code status: help wanted Indicates that a maintainer wants help on an issue or pull request team: backend Indicates that the issue or pull request is owned by the backend team type: enhancement Indicates new feature requests labels Nov 27, 2023
@davidberenstein1957 davidberenstein1957 added this to the v1.21.0 milestone Nov 28, 2023
@nataliaElv
Copy link
Member

Hi @plaguss . Just trying to understand the issue here: in which scenario it's needed to modify a response from the SDK? Isn't this a risk for the consistency of the dataset?

@plaguss
Copy link
Contributor Author

plaguss commented Nov 28, 2023

Hi! When @kursathalat was adding one of the examples for the end2end task (#4183) we found that responses cannot be updated from the sdk. The update_record method is not showing anything when we try to update the responses from the records as if everything worked out, but it's not really updating them.

@nataliaElv nataliaElv modified the milestones: v1.21.0, v1.22.0 Dec 19, 2023
@nataliaElv nataliaElv removed this from the v1.22.0 milestone Dec 19, 2023
@nataliaElv
Copy link
Member

Let's consider also the ability to add responses that already have a user_id: #4429

Copy link

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the status: stale Indicates that there is no activity on an issue or pull request label May 30, 2024
Copy link

This issue was closed because it has been inactive for 30 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints area: python sdk Indicates that an issue or pull request is related to the Python SDK language: python Pull requests or issues that update Python code status: help wanted Indicates that a maintainer wants help on an issue or pull request status: stale Indicates that there is no activity on an issue or pull request team: backend Indicates that the issue or pull request is owned by the backend team type: enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

4 participants