-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(document-search): batch ingestion from sources
- Loading branch information
1 parent
17d7b3d
commit f7f79a9
Showing
10 changed files
with
130 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/ragbits-document-search/tests/unit/example_files/bar.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bar |
1 change: 1 addition & 0 deletions
1
packages/ragbits-document-search/tests/unit/example_files/foo.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo |
1 change: 1 addition & 0 deletions
1
packages/ragbits-document-search/tests/unit/example_files/lorem.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lorem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/ragbits-document-search/tests/unit/test_local_file_source.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pathlib import Path | ||
|
||
from ragbits.document_search.documents.sources import LocalFileSource | ||
|
||
TEST_FILE_PATH = Path(__file__) | ||
|
||
|
||
async def test_local_source_fetch(): | ||
source = LocalFileSource(path=TEST_FILE_PATH) | ||
|
||
path = await source.fetch() | ||
assert path == TEST_FILE_PATH | ||
|
||
|
||
async def test_local_source_list_sources(): | ||
example_files = TEST_FILE_PATH.parent / "example_files" | ||
sources = LocalFileSource.list_sources(example_files, file_pattern="*.md") | ||
|
||
assert len(sources) == 2 | ||
assert all(isinstance(source, LocalFileSource) for source in sources) | ||
assert all(source.path.suffix == ".md" for source in sources) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.