Skip to content

Commit

Permalink
fix: PyMuPDF Reader broken (run-llama#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanuelCampos authored Sep 28, 2023
1 parent 2086fb2 commit 03fd5e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llama_hub/file/pymu_pdf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from llama_index import download_loader
PyMuPDFReader = download_loader("PyMuPDFReader")

loader = PyMuPDFReader()
documents = loader.load(file_path=Path('./article.pdf'), metadata=True)
documents = loader.load_data(file_path=Path('./article.pdf'), metadata=True)
```

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/jerryjliu/gpt_index/tree/main/gpt_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent. See [here](https://github.com/emptycrown/llama-hub/tree/main) for examples.
9 changes: 9 additions & 0 deletions llama_hub/file/pymu_pdf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
class PyMuPDFReader(BaseReader):
"""Read PDF files using PyMuPDF library."""

def load_data(
self,
file_path: Union[Path, str],
metadata: bool = True,
extra_info: Optional[Dict] = None,
) -> List[Document]:
"""Loads list of documents from PDF file and also accepts extra information in dict format."""
return self.load(file_path, metadata=metadata, extra_info=extra_info)

def load(
self,
file_path: Union[Path, str],
Expand Down

0 comments on commit 03fd5e4

Please sign in to comment.