Skip to content

Add .docx support to RAG document loader - #277

Open
pcbeingused333 wants to merge 1 commit into
pyfenn:mainfrom
pcbeingused333:feat/docx-loader
Open

Add .docx support to RAG document loader#277
pcbeingused333 wants to merge 1 commit into
pyfenn:mainfrom
pcbeingused333:feat/docx-loader

Conversation

@pcbeingused333

Copy link
Copy Markdown

Closes #97 (or: relates to #97 — see note below)

What

Adds Word (.docx) support to fenn/agents/rag/loader.py, following the same
pattern as the existing _read_pdf loader.

  • .docx added to SUPPORTED_EXTENSIONS
  • _read_file now routes .docx files to a new _read_docx helper
  • _read_docx extracts text from both paragraphs and table cells using python-docx
  • New optional extra rag-docx = ["python-docx>=1.0.0"] (also added to rag-all)
  • Unit tests in tests/unit/agents/test_docx_loader.py

How it was tested

pytest tests/unit/agents/test_docx_loader.py — 6 passing:
paragraphs, table cells, empty document → None, _read_file delegation,
load_documents, and the missing-dependency ImportError.

Note / question for maintainers

The existing loader error messages reference cofone[pdf] / cofone[web], while
the package is fenn and the extras are rag-pdf / rag-web. I kept the same
wording (cofone[docx]) in the new _read_docx for consistency with the current
file — but happy to align everything to fenn[rag-docx] in this PR (or a separate
one) if you prefer. Just let me know which you'd rather have.

@ApusBerliozi
ApusBerliozi requested a review from blkdmr July 27, 2026 03:07
@ApusBerliozi ApusBerliozi added enhancement New feature or request templates Relates to templates labels Jul 27, 2026
@ApusBerliozi
ApusBerliozi self-requested a review July 27, 2026 03:09
@ApusBerliozi

Copy link
Copy Markdown
Contributor

Hey @pcbeingused333! Everything looks good for me.

@blkdmr, could you please take a look at this PR as well?

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

Labels

enhancement New feature or request templates Relates to templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add LLM Agent and RAG Support

2 participants