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

[BUGFIX] argilla server: parse fields for record schemas #5600

Merged

Conversation

frascuchon
Copy link
Member

Description

This PR fixes problem with record fields containing empty strings. The default behavior of pydantic is to cast as dicts {} (I really don't know why).

Also, a custom validator was needed to process chat field content properly. Otherwise, values as [{"role": "content"}] are automatically converted to {"role": "content"}

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

Checklist

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

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.23%. Comparing base (8b959c5) to head (1744628).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5600   +/-   ##
========================================
  Coverage    91.22%   91.23%           
========================================
  Files          145      145           
  Lines         6030     6036    +6     
========================================
+ Hits          5501     5507    +6     
  Misses         529      529           
Flag Coverage Δ
argilla-server 91.23% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@frascuchon frascuchon merged commit b9e3d03 into develop Oct 16, 2024
5 of 6 checks passed
@frascuchon frascuchon deleted the bugfix/argilla-server/parse-fields-for-record-schemas branch October 16, 2024 12:54
frascuchon added a commit that referenced this pull request Oct 17, 2024
)

# Description
<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that are required for this change. -->

Changes introduced in #5600
include a but when the fields in the `RecordCreate` schema already
contain `ChatFieldValue` object. This is the cause of [failing
integration tests in the develop
branch](https://github.com/argilla-io/argilla/actions/runs/11380531039/job/31660006108).

The custom validator must skip these objects even if the `pre` flag is
set to True.

This PR fixes the error.

**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)

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- I followed the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants