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

fix: format_as("datasets") when no responses #3224

Merged
merged 7 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ These are the section headers that we use:
### Fixed

- Replaced `np.float` alias by `float` to avoid `AttributeError` when using `find_label_errors` function with `numpy>=1.24.0` ([#3214](https://github.com/argilla-io/argilla/pull/3214)).
- Fixed `format_as("datasets")` when no responses or optional respones in `FeedbackRecord`, to set their value to what 🤗 Datasets expects instead of just `None` ([#3224](https://github.com/argilla-io/argilla/pull/3224)).

### Added

Expand Down
7 changes: 3 additions & 4 deletions src/argilla/client/feedback/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,12 @@ def format_as(self, format: Literal["datasets"]) -> "Dataset":
dataset[question.name].append(
[
{
"user_id": r.user_id,
"value": r.values[question.name].value,
"status": r.status,
"user_id": r.user_id or None,
"value": r.values[question.name].value or None,
alvarobartt marked this conversation as resolved.
Show resolved Hide resolved
alvarobartt marked this conversation as resolved.
Show resolved Hide resolved
"status": r.status or None,
}
for r in record.responses
]
or None
)
dataset["metadata"].append(json.dumps(record.metadata) if record.metadata else None)
dataset["external_id"].append(record.external_id or None)
Expand Down
11 changes: 0 additions & 11 deletions tests/client/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,17 +428,6 @@ def feedback_dataset_records() -> List[FeedbackRecord]:
),
FeedbackRecord(
fields={"text": "This is a negative example", "label": "negative"},
responses=[
{
"values": {
"question-1": {"value": "This is a response to question 1"},
"question-2": {"value": 1},
"question-3": {"value": "a"},
"question-4": {"value": ["a", "b"]},
},
"status": "submitted",
}
],
alvarobartt marked this conversation as resolved.
Show resolved Hide resolved
metadata={"another unit": "test"},
external_id="2",
),
Expand Down