def process_pdf_files(index):
pdf_directory = "./data/documents"
llama_parse = LlamaParse(result_type="markdown")
for filename in os.listdir(pdf_directory):
if filename.endswith(".pdf"):
file_path = os.path.join(pdf_directory, filename)
try:
# Parse the PDF file
documents = llama_parse.load_data(file_path)
# Upload the parsed content to LlamaCloud
for doc in documents:
index.insert(doc)
logger.info(f"Uploaded: {filename}")
except Exception as e:
logger.error(f"Error processing {filename}: {str(e)}")
# Add a small delay between files to avoid rate limiting
time.sleep(1)
try to parse Thai pdf files and it doesn't work! It's my first time to use LLAMA_PARSE though.
try to parse Thai pdf files and it doesn't work! It's my first time to use LLAMA_PARSE though.