Skip to main content

llama-index readers llama-parse integration

Project description

LlamaParse

LlamaParse is an API created by LlamaIndex to efficiently parse and represent files for efficient retrieval and context augmentation using LlamaIndex frameworks.

LlamaParse directly integrates with LlamaIndex.

Currently available for free. Try it out today!

Getting Started

First, login and get an api-key from https://cloud.llamaindex.ai.

Then, make sure you have the latest LlamaIndex version installed.

pip uninstall llama-index  # run this if upgrading from v0.9.x or older
pip install -U llama-index --upgrade --no-cache-dir --force-reinstall

Lastly, install the package:

pip install llama-parse

Now you can run the following to parse your first PDF file:

import nest_asyncio

nest_asyncio.apply()

from llama_parse import LlamaParse

parser = LlamaParse(
    api_key="llx-...",  # can also be set in your env as LLAMA_CLOUD_API_KEY
    result_type="markdown",  # "markdown" and "text" are available
    verbose=True,
)

# sync
documents = parser.load_data("./my_file.pdf")

# sync batch
documents = parser.load_data(["./my_file1.pdf", "./my_file2.pdf"])

# async
documents = await parser.aload_data("./my_file.pdf")

# async batch
documents = await parser.aload_data(["./my_file1.pdf", "./my_file2.pdf"])

Using with SimpleDirectoryReader

You can also integrate the parser as the default PDF loader in SimpleDirectoryReader:

import nest_asyncio

nest_asyncio.apply()

from llama_parse import LlamaParse
from llama_index.core import SimpleDirectoryReader

parser = LlamaParse(
    api_key="llx-...",  # can also be set in your env as LLAMA_CLOUD_API_KEY
    result_type="markdown",  # "markdown" and "text" are available
    verbose=True,
)

file_extractor = {".pdf": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

Full documentation for SimpleDirectoryReader can be found on the LlamaIndex Documentation.

Examples

Several end-to-end indexing examples can be found in the examples folder

Terms of Service

See the Terms of Service Here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_readers_llama_parse-0.5.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_readers_llama_parse-0.5.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_llama_parse-0.5.1.tar.gz
Algorithm Hash digest
SHA256 2b78b73faa933e30e6c69df351e4e9f36dfe2ae142e2ab3969ddd2ac48930e37
MD5 ed35b718c1adee02a4e756aa9c9ceaae
BLAKE2b-256 b3775bfaab20e6ec8428dbf2352e18be550c957602723d69383908176b5686cd

See more details on using hashes here.

File details

Details for the file llama_index_readers_llama_parse-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_llama_parse-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0d41450ed29b0c49c024e206ef6c8e662b1854e77a1c5faefed3b958be54f880
MD5 66a1a5fa1706ac0cd92297133dc933cf
BLAKE2b-256 688152410c7245dcbf1a54756a9ce3892cdd167ec0b884d696de1304ca3f452e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page