Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable support for custom filesystem #117

Merged
merged 12 commits into from
Sep 10, 2024

Conversation

thiagosalvatore
Copy link
Contributor

Custom FileSystems that are now available on llama-index were not available on llama-parse. We can now use it to download files using any reader like S3Reader.

Fixes #116

@thiagosalvatore
Copy link
Contributor Author

@logan-markewich can you take a look at this when you have some time, please?

fs = fs or get_default_fs()
with fs.open(file_path, "rb") as f:
mime_type = mimetypes.guess_type(str_file_path)[0]
files = {"file": (self.__get_filename(f), f, mime_type)}
Copy link
Contributor

@logan-markewich logan-markewich Apr 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works, at least locally, it doesn't work for me

Since we already have the path, can't we use that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using it in production right now and it is working properly. What is the error that you are getting locally?

The issue with the path is that I've seen situations in production where people upload a file with .txt but the file is actually a .csv and it doesn't work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:sigh: this still doesn't work guys lol

>>> from llama_parse import LlamaParse
>>> documents = LlamaParse(api_key="llx-...").load_data("2023.acl-srw.0.pdf")
Error while parsing the file '2023.acl-srw.0.pdf': '_io.BufferedReader' object has no attribute 'full_name'
>>> 

@sheresaidon
Copy link

@logan-markewich whenever you have a chance could you please review, currently llama parse is giving me the fs error when trying to use it with GCS Reader

parser = LlamaParse(result_type="markdown", api_key=LLAMA_PARSE_API_KEY,verbose=True, show_progress=True)

reader = GCSReader(
    bucket=bucket_name,
    key=file_path,  # Use the extracted file path
    file_extractor={".pdf": parser, ".docx": parser, ".txt": parser},
    service_account_key=service_account_key_dict
)

LlamaParse.load_data() got an unexpected keyword argument 'fs'. Skipping...

@thiagosalvatore
Copy link
Contributor Author

@logan-markewich any updates here? I've been using this fix in prod for a while without any issues

@gjyoungjr
Copy link

any timeline on when this PR will get merged? my team is also blocked by not having this featue.

does anyone know a current work around to load files that are not local in your directory?

@logan-markewich
Copy link
Contributor

logan-markewich commented Jun 26, 2024

this still doesn't work 😅

>>> from llama_parse import LlamaParse
>>> documents = LlamaParse(api_key="llx-...").load_data("2023.acl-srw.0.pdf")
Error while parsing the file '2023.acl-srw.0.pdf': '_io.BufferedReader' object has no attribute 'full_name'
>>> 

Copy link
Contributor

@logan-markewich logan-markewich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still broken actually, see above

@logan-markewich
Copy link
Contributor

Ok, I think this works, but haven't actually tested it with an external file system

@logan-markewich logan-markewich merged commit 7cb6d06 into run-llama:main Sep 10, 2024
8 checks passed
@rohanprashant12
Copy link

Thanks @logan-markewich and @thiagosalvatore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New FS not supported by llama-parse
5 participants