Skip to main content

llama-index readers json integration

Project description

LlamaIndex Readers Integration: Json

Overview

JSON Reader reads JSON documents with options to help extract relationships between nodes. It provides functionalities to control the depth of JSON traversal, collapse long JSON fragments, and clean JSON structures.

Installation

You can install JSON Reader via pip:

pip install llama-index-readers-json

Usage

from llama_index.readers.json import JSONReader

# Initialize JSONReader
reader = JSONReader(
    # The number of levels to go back in the JSON tree. Set to 0 to traverse all levels. Default is None.
    levels_back="<Levels Back>",
    # The maximum number of characters a JSON fragment would be collapsed in the output. Default is None.
    collapse_length="<Collapse Length>",
    # If True, ensures that the output is ASCII-encoded. Default is False.
    ensure_ascii="<Ensure ASCII>",
    # If True, indicates that the file is in JSONL (JSON Lines) format. Default is False.
    is_jsonl="<Is JSONL>",
    # If True, removes lines containing only formatting from the output. Default is True.
    clean_json="<Clean JSON>",
)

# Load data from JSON file
documents = reader.load_data(input_file="<Input File>", extra_info={})

This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent.

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_json-0.2.0.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

llama_index_readers_json-0.2.0-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

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