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.
NOTE: If you are upgrading from v0.9.X, we recommend following our migration guide, as well as uninstalling your previous version first.
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
Built Distribution
File details
Details for the file llama_index_readers_llama_parse-0.4.0.tar.gz
.
File metadata
- Download URL: llama_index_readers_llama_parse-0.4.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e99ec56f4f8546d7fda1a7c1ae26162fb9acb7ebcac343b5abdb4234b4644e0f |
|
MD5 | 8664f8d7c6bd97ee88bfd28a0e7cc5cf |
|
BLAKE2b-256 | 35304611821286f82ba7b5842295607baa876262db86f88b87d83595eed172bf |
File details
Details for the file llama_index_readers_llama_parse-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_readers_llama_parse-0.4.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 574e48386f28d2c86c3f961ca4a4906910312f3400dd0c53014465bfbc6b32bf |
|
MD5 | e9cf4bf2b7fc4670ce31330bc6911bdd |
|
BLAKE2b-256 | 684fe30d4257fe9e4224f5612b77fe99aaceddae411b2e74ca30534491de3e6f |