Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
implement lazy import for langchain in pdfreader (#163)
Browse files Browse the repository at this point in the history
* add lazy import for langchain in pdfreader

* update autollm version
  • Loading branch information
SeeknnDestroy authored Nov 29, 2023
1 parent 161b783 commit 117491d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autollm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
and vector databases, along with various utility functions.
"""

__version__ = '0.1.1'
__version__ = '0.1.2'
__author__ = 'safevideo'
__license__ = 'AGPL-3.0'

Expand Down
3 changes: 2 additions & 1 deletion autollm/utils/pdf_reader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import List

from langchain.document_loaders import PDFMinerLoader
from llama_index.readers.base import BaseReader
from llama_index.schema import Document

Expand All @@ -16,6 +15,8 @@ def __init__(self, extract_images: bool = False) -> None:

def load_data(self, file_path: str, extra_info: dict = None) -> List[Document]:
"""Load data from a PDF file using langchain's PDFMinerLoader."""
from langchain.document_loaders import PDFMinerLoader

# Convert the PosixPath object to a string before passing it to PDFMinerLoader
loader = PDFMinerLoader(str(file_path), extract_images=self.extract_images)

Expand Down

0 comments on commit 117491d

Please sign in to comment.