From 9b70131aed02221866b2590e787a0e0703e1aad7 Mon Sep 17 00:00:00 2001 From: Hyeongchan Kim Date: Thu, 28 Mar 2024 07:31:54 +0900 Subject: [PATCH] community[patch]: refactor the type hint of `file_path` in `UnstructuredAPIFileLoader` class (#18839) * **Description**: add `None` type for `file_path` along with `str` and `List[str]` types. * `file_path`/`filename` arguments in `get_elements_from_api()` and `partition()` can be `None`, however, there's no `None` type hint for `file_path` in `UnstructuredAPIFileLoader` and `UnstructuredFileLoader` currently. * calling the function with `file_path=None` is no problem, but my IDE annoys me lol. * **Issue**: N/A * **Dependencies**: N/A Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> --- .../langchain_community/document_loaders/unstructured.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/community/langchain_community/document_loaders/unstructured.py b/libs/community/langchain_community/document_loaders/unstructured.py index 22df465589d..bc056ca7025 100644 --- a/libs/community/langchain_community/document_loaders/unstructured.py +++ b/libs/community/langchain_community/document_loaders/unstructured.py @@ -156,7 +156,7 @@ class UnstructuredFileLoader(UnstructuredBaseLoader): def __init__( self, - file_path: Union[str, List[str], Path, List[Path]], + file_path: Union[str, List[str], Path, List[Path], None], mode: str = "single", **unstructured_kwargs: Any, ): @@ -255,7 +255,7 @@ class UnstructuredAPIFileLoader(UnstructuredFileLoader): def __init__( self, - file_path: Union[str, List[str]] = "", + file_path: Union[str, List[str], None] = "", mode: str = "single", url: str = "https://api.unstructured.io/general/v0/general", api_key: str = "",