Skip to main content

llama-index readers document360 integration

Project description

LlamaIndex Readers Integration: Document360

The Document360Reader class is a custom reader that interacts with the Document360 API to fetch articles. It processes these articles recursively and allows further handling via custom callback functions, while also handling rate limiting and errors.

Installation

pip install llama-index-readers-document360

Usage

from document360_reader import Document360Reader

reader = Document360Reader(api_key="your_api_key")

# Load data
documents = reader.load_data()

# Use the documents as needed
for doc in documents:
    print(doc.text)

Class Initialization

def __init__(
    self,
    api_key: str,
    should_process_project_version=None,
    should_process_category=None,
    should_process_article=None,
    handle_batch_finished=None,
    handle_rate_limit_error=None,
    handle_request_http_error=None,
    handle_category_processing_started=None,
    handle_article_processing_started=None,
    handle_article_processing_error=None,
    handle_load_data_error=None,
    article_to_custom_document=None,
    rate_limit_num_retries=10,
    rate_limit_retry_wait_time=30,
):
    pass

api_key: Your Document360 API key (required). should_process_project_version: Callback to determine whether to process a project version. should_process_category: Callback to determine whether to process a category. should_process_article: Callback to determine whether to process an article. handle_batch_finished: Callback executed after all articles are processed. handle_rate_limit_error: Callback for handling rate limit errors. handle_request_http_error: Callback for handling HTTP errors. handle_category_processing_started: Callback triggered when category processing starts. handle_article_processing_started: Callback triggered when article processing starts. handle_article_processing_error: Callback for handling errors during article processing. handle_load_data_error: Callback for handling errors during data loading. article_to_custom_document: Custom transformation function to map an article to a document. rate_limit_num_retries: Number of retry attempts when hitting rate limits. rate_limit_retry_wait_time: Time to wait (in seconds) between retries after a rate limit error.

Referencing entities

from llama_index.readers.document360.entities import (
    Article,
    ArticleSlim,
    Category,
    ProjectVersion,
)


def handle_category_processing_started(category: Category):
    logging.info(f"Started processing category: {category}")


def handle_article_processing_started(article: Article):
    logging.info(f"Processing article: {article}")

All the fields in the entities are marked as Optional. This is because the actual API responses from Document360 sometimes do not match the expected schema mentioned in the API documentation.

Referencing errors

from llama_index.readers.document360.errors import (
    RetryError,
    HTTPError,
    RateLimitException,
)

reader = Document360Reader(api_key="your_api_key")

try:
    reader.load_data()
except RetryError as e:
    logging.info(f"Retry Error: {e}")

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_document360-0.4.0.tar.gz (7.0 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_document360-0.4.0.tar.gz.

File metadata

  • Download URL: llama_index_readers_document360-0.4.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_readers_document360-0.4.0.tar.gz
Algorithm Hash digest
SHA256 98d0877c95ca817a329bfdd2f43643ca946ef72a63d8a0762a679f892ba5ee79
MD5 82bc8f8df56f21ccb90ec46b5b6fcf3f
BLAKE2b-256 173ef38c6b3e7d4a9668dc8c07b6db692c812092b73c84cf0303c64ee406da73

See more details on using hashes here.

File details

Details for the file llama_index_readers_document360-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_readers_document360-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_readers_document360-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3619290887afb699ed2acbb091363aaf7f61c5b36905a55029ebc6f060dc6b01
MD5 c8f2c86dbba782b90aab71f477626007
BLAKE2b-256 7f6654a883fb4d56c4728f9ed2100885f713be6feb6ed7046d507a6893833228

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