diff --git a/llama-index-integrations/readers/llama-index-readers-microsoft-onedrive/llama_index/readers/microsoft_onedrive/base.py b/llama-index-integrations/readers/llama-index-readers-microsoft-onedrive/llama_index/readers/microsoft_onedrive/base.py index 81cff6103c5c1..e023626d16d11 100644 --- a/llama-index-integrations/readers/llama-index-readers-microsoft-onedrive/llama_index/readers/microsoft_onedrive/base.py +++ b/llama-index-integrations/readers/llama-index-readers-microsoft-onedrive/llama_index/readers/microsoft_onedrive/base.py @@ -4,17 +4,18 @@ import os import tempfile import time -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional from pathlib import Path import requests -from llama_index.core.readers import SimpleDirectoryReader -from llama_index.core.readers.base import BaseReader, BasePydanticReader +from typing_extensions import Unpack + +from llama_index.core.readers import SimpleDirectoryReader, DirectoryReaderArgs +from llama_index.core.readers.base import BasePydanticReader from llama_index.core.schema import Document -from llama_index.core.bridge.pydantic import PrivateAttr, Field, BaseModel +from llama_index.core.bridge.pydantic import PrivateAttr, BaseModel from llama_index.core.readers import FileSystemReaderMixin from llama_index.core.readers.base import ( - BaseReader, BasePydanticReader, ResourcesReaderMixin, ) @@ -68,10 +69,6 @@ class OneDriveReader(BasePydanticReader, ResourcesReaderMixin, FileSystemReaderM file_ids: Optional[List[str]] = None folder_path: Optional[str] = None file_paths: Optional[List[str]] = None - required_exts: Optional[List[str]] = None - file_extractor: Optional[Dict[str, Union[str, BaseReader]]] = Field( - default=None, exclude=True - ) attach_permission_metadata: bool = False _is_interactive_auth = PrivateAttr(False) @@ -87,10 +84,8 @@ def __init__( file_ids: Optional[List[str]] = None, folder_path: Optional[str] = None, file_paths: Optional[List[str]] = None, - file_extractor: Optional[Dict[str, Union[str, BaseReader]]] = None, attach_permission_metadata: bool = False, - required_exts: Optional[List[str]] = None, - **kwargs, + **kwargs: Unpack[DirectoryReaderArgs], ) -> None: super().__init__( client_id=client_id, @@ -101,9 +96,7 @@ def __init__( file_ids=file_ids, folder_path=folder_path, file_paths=file_paths, - file_extractor=file_extractor, attach_permission_metadata=attach_permission_metadata, - required_exts=required_exts, **kwargs, ) self._is_interactive_auth = not client_secret @@ -562,10 +555,9 @@ def get_metadata(filename: str) -> Any: simple_loader = SimpleDirectoryReader( directory, - file_extractor=self.file_extractor, - required_exts=self.required_exts, file_metadata=get_metadata, recursive=recursive, + **self.model_dump(), ) return simple_loader.load_data()