community: add init for unstructured file loader (#29101)

## Description
Add `__init__` for unstructured loader of
epub/image/markdown/pdf/ppt/word to restrict the input type to `str` or
`Path`.
In the
[signature](https://python.langchain.com/api_reference/community/document_loaders/langchain_community.document_loaders.markdown.UnstructuredMarkdownLoader.html)
these unstructured loaders receive `file_path: str | List[str] | Path |
List[Path]`, but actually they only receive `str` or `Path`.

## Issue
None

## Dependencies
No changes.
This commit is contained in:
LIU Yuwei
2025-01-13 22:26:00 +08:00
committed by GitHub
parent bbc3e3b2cf
commit f980144e9c
13 changed files with 157 additions and 56 deletions

View File

@@ -42,6 +42,7 @@ class UnstructuredExcelLoader(UnstructuredFileLoader):
for more info. Optional. Defaults to "single".
**unstructured_kwargs: Keyword arguments to pass to unstructured.
"""
file_path = str(file_path)
validate_unstructured_version(min_unstructured_version="0.6.7")
super().__init__(file_path=file_path, mode=mode, **unstructured_kwargs)