Conversation
adaumsilva
left a comment
There was a problem hiding this comment.
@Guru2907 Thanks for adding DirectoryLoader! Please address these before merging:
- Fix
recursive=False: the default**/*pattern still loads nested files. - Register the default PDF loader only when
pypdfis available, as required by #34. - Add regression tests for both scenarios.
- Count skipped unsupported files as requested in the issue.
- Move the changelog entry from
0.1.0toUnreleased.
All CI checks passed, but I reproduced both functional issues locally.
1f1053a to
622631e
Compare
|
Thanks for the review, @adaumsilva! All points are addressed:
The document tests pass locally (165 passed). Could you approve the workflow run and take another look when you have a moment? Thanks! |
adaumsilva
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous feedback @Guru2907 ! The non-recursive traversal and conditional PDF registration now work, and the changelog entry is correctly under Unreleased. All four CI checks pass, and I reproduced 165 passing document tests locally.
One issue remains in DirectoryLoader.load(): skipped_count is initialized only in __init__, so it accumulates when the loader is reused, despite the update stating it resets on each call.
With one unsupported file, I reproduced:
- First load:
skipped_count == 1 - Second load:
skipped_count == 2 - After removing the unsupported file: still
2
Please reset self.skipped_count = 0 at the start of load() and add a regression test that reuses the same loader, verifying the counts are 1, 1, then 0.
The remaining reviewed changes look good.
Summary
Implements
DirectoryLoaderfor ingesting documents from a directory with per-extension loader dispatch.Changes
DirectoryLoadertoragframework/document/loaders.py.txt,.md,.markdown, and.pdfrelative_pathmetadata to loaded documentson_error="skip"andon_error="raise"handlingLoaderErrorDirectoryLoaderfromragframework.documentTesting
Focused document loader tests:
15 passedFull test suite:
258 passed12 failedThe 12 failures are in the ChromaDB tests because the optional
chromadbdependency is not installed in the current environment. These failures are unrelated toDirectoryLoader.Related issue
Closes #34