Skip to content

feat: add DOCX document loader - #78

Merged
adaumsilva merged 9 commits into
adaumsilva:mainfrom
deepakjanapa:add-docx-loader
Sep 27, 2026
Merged

adaumsilva merged 9 commits into
adaumsilva:mainfrom
deepakjanapa:add-docx-loader

Conversation

@deepakjanapa

Copy link
Copy Markdown
Contributor

Description

Adds a DocxLoader for loading DOCX documents into the RAG framework, with support for both per-paragraph and whole-file loading modes.

Closes #2

Changes

  • Added DocxLoader using the optional python-docx dependency
  • Added support for per-paragraph and whole-file loading
  • Added LoaderError handling for missing and invalid DOCX files
  • Exported DocxLoader from ragframework.document
  • Added unit tests for DOCX loading and error cases
  • Updated CHANGELOG.md under [Unreleased]

Type of change

  • Bug fix
  • New feature / integration
  • Documentation update
  • Refactor / code quality

Checklist

  • pytest tests/ -v passes locally
  • ruff check ragframework/ passes
  • mypy ragframework/ passes
  • New or updated tests cover the changes
  • Optional dependencies are guarded with a helpful import error
  • Docstrings updated where applicable
  • CHANGELOG.md updated under [Unreleased]

@adaumsilva adaumsilva left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for adding DOCX support! Please address these before merging:

  • Restore the existing chunker imports and __all__ entries in ragframework.document; removing them breaks public imports.
  • Install the docx extra in CI for the new tests and add coverage for the missing-dependency error.
  • Restore the 0.2.0 changelog heading.
  • Fix the Ruff failures and rerun CI; all three Python jobs currently stop before running tests.

Both DOCX loading modes worked in my local checks.

@adaumsilva

Copy link
Copy Markdown
Owner

@deepakjanapa thanks for contributing. I requestes a few changes before merging the PR. Please address these changes.

@deepakjanapa

Copy link
Copy Markdown
Contributor Author

Hi @adaumsilva, I’ve addressed all the requested changes:

  • Restored the chunker imports and __all__ entries.
  • Added the docx extra to CI and coverage for the missing-dependency case.
  • Restored the 0.2.0 changelog heading.
  • Fixed the Ruff issues.
  • Re-ran the full test suite locally: 270 passed.

The latest CI workflow is currently showing “Action required” / awaiting maintainer approval, so I believe it just needs approval before the CI jobs can run.

Thanks!

@adaumsilva adaumsilva left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for adding DOCX support. All 13 loader tests pass locally with python-docx installed, and Ruff passes.

One issue needs fixing: mypy fails when python-docx is installed because DocxDocument is imported as a function and then assigned None in the ImportError handler.

Please:

  • Move the guarded import inside DocxLoader.load(), preserving the helpful LoaderError when the dependency is unavailable, or use a correctly typed optional callable.
  • Add the docx extra to the type-check CI installation (".[faiss,docx]"). Currently that job does not install python-docx, so it misses this error.
  • Rerun mypy and the loader tests after the change.

Please also resolve the CHANGELOG.md conflict while preserving existing entries. I’ll handle the final changelog organization after the pending PRs are merged.

Once these changes are pushed and checks pass, please request another review.

@deepakjanapa

Copy link
Copy Markdown
Contributor Author

Hi @adaumsilva, I’ve pushed the requested fixes in 61aaca6.

  • Moved the guarded python-docx import into DocxLoader.load() to resolve the mypy issue.
  • Added the docx extra to the type-check CI installation.
  • Added coverage for the missing-dependency case.
  • Resolved the CHANGELOG merge conflict while preserving the existing entries.

The DOCX loader tests (13/13), Ruff, and mypy for the loader pass locally. The GitHub Actions workflow is currently awaiting maintainer approval before the required checks can run.

Once the checks are approved and pass, I’ll request another review.

@adaumsilva adaumsilva left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for addressing the requested changes! The guarded import, public exports, and CI dependencies look good.

All 13 loader tests pass locally, Ruff and mypy for the loader pass, and all GitHub checks are green. No blocking issues remain.

Approved. I’ll handle the final changelog cleanup, including restoring the existing README roadmap entry. Thanks for contributing DOCX support!

@adaumsilva
adaumsilva merged commit 5a0be09 into adaumsilva:main Sep 27, 2026
4 checks passed
@adaumsilva

Copy link
Copy Markdown
Owner

Good job @deepakjanapa! PR Merged! Remember to star the repo if you didn't yet.

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.

DOCX Document Loader

2 participants