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!

NOTE: Currently, only PDF files are supported.

Getting Started

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

Install the package:

pip install llama-parse

Then, 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.1.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

  • Download URL: llama_index_readers_llama_parse-0.1.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for llama_index_readers_llama_parse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3306783b9f92aae2e14296c13d657c0927b31bcb051efd8525ee3927c58962d2
MD5 3702d65a6a8968c9006af09ef2328751
BLAKE2b-256 345d47806ce9944d608598b34ea1b168ef535aa6022fc36fd7c6d35888002e79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_readers_llama_parse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb066f1f845dc49fac87c8db9c52c39628ab0c4e6067b8c835e01d01f1158113
MD5 3792c2af244eeea548cad54398cced1b
BLAKE2b-256 4b2efd2becc3e6b8dd68a8ef996781917ec1ba0019f70f213c9d425ea359c2f0

See more details on using hashes here.

Supported by

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