Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions docs/source/user_guide_kg_builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,15 @@ To implement your own loader, use the `DataLoader` interface:
from neo4j_graphrag.experimental.components.pdf_loader import DataLoader, PdfDocument

class MyDataLoader(DataLoader):
async def run(self, path: Path) -> PdfDocument:
# process file in `path`
return PdfDocument(text="text")
async def run(self, filepath: Path, metadata: Optional[Dict[str, str]] = None) -> PdfDocument:
# process file in `filepath`
return PdfDocument(
text="text",
document_info=DocumentInfo(
path=str(filepath),
metadata=metadata,
)
)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ async def run(
text="<extracted text>",
document_info=DocumentInfo(
path=str(filepath),
# optionally, add some metadata as a dict
metadata=None,
metadata=metadata,
),
)