LlamaIndex: Box Readers
This open-source integration brings the capabilities of Box.com to the LLama-Index, empowering developers building Retrieval Augmented Generation (RAG) and other LLM applications.
This README will guide you through installation, usage, and explore the functionalities of each reader.
Installation
pip install llama-index-readers-box
Available readers
We provide multiple readers, including:
- Box Reader - Implementation of the SimpleReader interface to read files from Box.
- Box Text Extraction - Uses Box text representation to extract text from document.
- Box AI Prompt - Uses Box AI to extract context from documents
- Box AI Extraction - Uses Box AI to extract structured data from documents
Authentication
Client credential gran (CCG)
Create a new application in the Box Developer Console and generate a new client ID and client secret. Create a .env file with the following content:
# CCG settings
BOX_CLIENT_ID = YOUR_CLIENT_ID
BOX_CLIENT_SECRET = YOUR_CLIENT_SECRET
# Common Settings
BOX_ENTERPRISE_ID = YOUR_BOX_ENTERPRISE_ID
BOX_USER_ID = YOUR_BOX_USER_ID (optional)
By default the CCG client will use a service account associated with the application. Depending on how the files are shared, the service account may not have access to all the files.
If you want to use a different user, you can specify the user ID in the .env file. In this case make sure your application can impersonate and/or generate user tokens in the scope.
Checkout this guide for more information on how to setup the CCG: Box CCG Guide
JSON web tokens (JWT)
Create a new application in the Box Developer Console and generate a new .config.json file.
Create a .env file with the following content:
# Common settings
BOX_ENTERPRISE_ID = 877840855
BOX_USER_ID = 18622116055
# JWT Settings
JWT_CONFIG_PATH = /path/to/your/.config.json
By default the JWT client will use a service account associated with the application. Depending on how the files are shared, the service account may not have access to all the files.
If you want to use a different user, you can specify the user ID in the .env file. In this case make sure your application can impersonate and/or generate user tokens in the scope.
Checkout this guide for more information on how to setup the JWT: Box JWT Guide
pip install "box-sdk-gen[jwt]"
Box Client
To work with the box readers, you will need to provide a Box Client. The Box Client can be created using either the Client Credential Grant (CCG), JSON Web Tokens (JWT), OAuth 2.0, and developer token.
Using CCG authentication
from box_sdk_gen import CCGConfig, BoxCCGAuth, BoxClient
config = CCGConfig(
client_id="your_client_id",
client_secret="your_client_secret",
enterprise_id="your_enterprise_id",
user_id="your_ccg_user_id", # Optional
)
auth = BoxCCGAuth(config)
if config.user_id:
auth.with_user_subject(config.user_id)
client = BoxClient(auth)
reader = BoxReader(box_client=client)
Using JWT authentication
from box_sdk_gen import JWTConfig, BoxJWTAuth, BoxClient
# Using manual configuration
config = JWTConfig(
client_id="YOUR_BOX_CLIENT_ID",
client_secret="YOUR_BOX_CLIENT_SECRET",
jwt_key_id="YOUR_BOX_JWT_KEY_ID",
private_key="YOUR_BOX_PRIVATE_KEY",
private_key_passphrase="YOUR_BOX_PRIVATE_KEY_PASSPHRASE",
enterprise_id="YOUR_BOX_ENTERPRISE_ID",
user_id="YOUR_BOX_USER_ID",
)
# Using configuration file
config = JWTConfig.from_config_file("path/to/your/.config.json")
user_id = "1234"
if user_id:
config.user_id = user_id
config.enterprise_id = None
auth = BoxJWTAuth(config)
client = BoxClient(auth)
reader = BoxReader(box_client=client)
Author
Box-Community This is an open source reader, contributions are welcome.
This loader is designed to be used as a way to load data into LlamaIndex.
Metadata
Release files for llama-index-readers-box 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_readers_box-0.6.0.tar.gz | 14.9 kB | Without provenance | Details for llama_index_readers_box-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_readers_box-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_readers_box-0.6.0-py3-none-any.whl |
Total release size: 41.4 kB
Release files / llama_index_readers_box-0.6.0.tar.gz
| Download URL | llama_index_readers_box-0.6.0.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4876515fde86df131f1e933bb244148252a56a2a21f3aeec0196104988a37b4d
|
|
BLAKE2b-256 checksum How to use checksums |
0ce031b608ef0ff558dde03c507b50c0ccd11f4c0ae301c192a96b71434392ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_readers_box-0.6.0-py3-none-any.whl
| Download URL | llama_index_readers_box-0.6.0-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a18d0c166baed5fa5fa4b9d82725f2ef1eea9908a636137b1a8e01613b266666
|
|
BLAKE2b-256 checksum How to use checksums |
42d233d27fb8c3466e1f77800827c13d9f37a2a073c05cf0f3d9fe2e0fb24f53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llama-index-readers-box 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.