-
Notifications
You must be signed in to change notification settings - Fork 105
fix: DoclingDocument model validator should deal with any raw input #419
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
Conversation
|
✅ DCO Check Passed Thanks @ceberam, all your commits are properly signed off. 🎉 |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 Require two reviewer for test updatesWonderful, this rule succeeded.When test data is updated, we require two reviewers
|
test/test_docling_doc.py
Outdated
|
|
||
| # test that transform_to_content_layer model validator can handle any data type | ||
| class ContentOutput(BaseModel): | ||
| content: str | DoclingDocument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Union needed here for 3.9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also added a minor update in README
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
01a85de to
99dec97
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
99dec97 to
ab24dd7
Compare
The
transform_to_content_layermodel validator ofDoclingDocumentis of type before, since it may need to transform the raw input before theDoclingDocumentis instantiated.However, it assumes that the raw input data is a
dictand this may create issues like described in docling-project/docling#2616.Since before validators have to deal with the raw input, which in theory could be any arbitrary object, a type check has been added.
Resolves docling-project/docling#2616