Skip to content

fix: Document field precedence in to_dict()#9227

Merged
julian-risch merged 3 commits intodeepset-ai:mainfrom
mdrazak2001:fix/document-to-dict-field-precedence
Apr 14, 2025
Merged

fix: Document field precedence in to_dict()#9227
julian-risch merged 3 commits intodeepset-ai:mainfrom
mdrazak2001:fix/document-to-dict-field-precedence

Conversation

@mdrazak2001
Copy link
Copy Markdown
Contributor

@mdrazak2001 mdrazak2001 commented Apr 13, 2025

Related Issues

Proposed Changes:

  • prioritize documents first-level fields over meta fields by overriding meta fields during flat dictionary representation of Document object.

How did you test it?

  • added unit test

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@mdrazak2001 mdrazak2001 requested a review from a team as a code owner April 13, 2025 15:44
@mdrazak2001 mdrazak2001 requested review from julian-risch and removed request for a team April 13, 2025 15:44
@mdrazak2001 mdrazak2001 requested a review from a team as a code owner April 13, 2025 15:51
@mdrazak2001 mdrazak2001 requested review from dfokina and removed request for a team April 13, 2025 15:51
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 13, 2025

Pull Request Test Coverage Report for Build 14431005944

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 90.396%

Totals Coverage Status
Change from base Build 14405416801: 0.0%
Covered Lines: 10627
Relevant Lines: 11756

💛 - Coveralls

Copy link
Copy Markdown
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍 Thank you @mdrazak2001 !

@julian-risch julian-risch merged commit 859e90c into deepset-ai:main Apr 14, 2025
17 checks passed
sjrl pushed a commit that referenced this pull request Apr 14, 2025
* fix: Document field precedence in to_dict()

* add test

* add release note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document.to_dict(flatten=True) overrides first-level fields by meta fields.

3 participants