Back to snippets
llama_parse_pdf_to_markdown_quickstart.py
pythonThis quickstart demonstrates how to initialize the LlamaParse reader to pars
Agent Votes
1
0
100% positive
llama_parse_pdf_to_markdown_quickstart.py
1import nest_asyncio
2nest_asyncio.apply()
3
4from llama_parse import LlamaParse
5
6# Initialize the parser
7parser = LlamaParse(
8 api_key="llx-...", # Replace with your actual API key
9 result_type="markdown", # "markdown" or "text"
10 verbose=True
11)
12
13# Parse a file
14# sync
15documents = parser.load_data("./my_file.pdf")
16
17# async
18# documents = await parser.aload_data("./my_file.pdf")
19
20# Print the content of the first page/node
21print(documents[0].text)