run-llama / llama_parse

Parse files for optimal RAG
https://www.llamaindex.ai
MIT License
2.72k stars 263 forks source link

Llamparse within SimpledirectoryReader doesn't accept PurePosixPath #421

Open seeifsalem opened 2 days ago

seeifsalem commented 2 days ago

Describe the bug I am using LlamaParse as an extractor within a SimpleDirectoryReader with fs as an s3 bucket. What will happen is that when load_data() from LlamaParse is called, the file_path will be a PurePosixPath (because of the design of SimpleDirectoryReader). _Path = Path if is_default_fs(self.fs) else PurePosixPath

The problem is that in llama_parse\base.py line 367 we have this check
if isinstance(file_path, (str, Path, bytes, BufferedIOBase)): It doesn't include PurePosixPath as an accepted instance so we can't load our files.

This should be an easy fix: if isinstance(file_path, (str, Path, PurePosixPath, bytes, BufferedIOBase)):