Uploaded pdf not parsing (Returns blank output) through llama in streamlit

I was unable to test this until right now.

When I pass a file-like object (the uploaded file)

st.session_state.doc_parsed = LlamaParse(
    result_type="markdown", api_key=key_input
).load_data(st.session_state.uploaded_file)

I get an empty list as well, along with a message in the terminal:

Error while parsing the file '<bytes/buffer>': file_name must be provided in extra_info when passing bytes

Passing extra_info={"file_name": "_"} to load_data as sugested by the message fixed it for me. As far as I can tell any non-empty string works. This is absent from the examples and I have no idea why it is needed.

2 Likes