Skip to content

Commit

Permalink
Fix loader constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
John Cordeiro committed Apr 8, 2024
1 parent 3cb128a commit f89dcae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/loaders/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _get_file(self, file: str):
return file_path
return file

def __init__(self, file:str) -> None:
def __init__(self, file:str, **kwargs) -> None:
self.file = self._get_file(file)
self.loader = TextLoader(self.file)

Expand Down Expand Up @@ -145,7 +145,7 @@ def pdf_loader(file: str) -> Callable:


class DocxLoader(DocumentLoader):
def __init__(self, file:str) -> None:
def __init__(self, file:str, **kwargs) -> None:
self.loader = Docx2txtLoader(file)

def load(self) -> List[Document]:
Expand Down Expand Up @@ -184,7 +184,7 @@ def xlsx_loader(file: str) -> Callable:
from urllib.request import urlretrieve
from urllib.parse import urlparse
class XlsxLoader(DocumentLoader):
def __init__(self, file:str) -> None:
def __init__(self, file:str, **kwargs) -> None:
tmp_file, _ = self._get_temp_file(file)
self.loader = UnstructuredExcelLoader(tmp_file, mode="single")

Expand Down Expand Up @@ -218,7 +218,7 @@ def _urls(self, urls: Union[List[str], str]):
return [urls]
return urls

def __init__(self, urls: Union[List[str], str]) -> None:
def __init__(self, urls: Union[List[str], str], **kwargs) -> None:
self.urls = self._urls(urls)
self.loader = UnstructuredURLLoader(urls=self.urls, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0"})

Expand Down

0 comments on commit f89dcae

Please sign in to comment.